On Thu, Feb 09, 2006, Bob Mearns wrote:
>
> genkeys() {
> DSA *dsa;
> unsigned char encodedPubKey[MAX];
> int pubLen, genstat;
> dsa = DSA_generate_parameters(...);
> /* error check*/
> genStat = DSA_generate_key(dsa);
> /* error check */
> pubLen = i2d_DSA_PUBKEY(dsa, &encodedPubKey);
> /* error check */
> }
>
> verify(const unsigned char *encodedKeyPtr, long encodedKeyLen, ...) {
> DSA *pPubKey;
> int vStat;
> pPubKey =DSA_new();
> /* error check */
> pPubKey = d2i_DSA_PUBKEY(&pPubKey,
> &encodedKeyPtr, encodedKeyLen);
> /* error check */
> vStat = DSA_verify(..., pPubKey);
> /* error check */
> }
>
> Any help appreciated.
>
The correct way to use the i2d functions is mentioned in the FAQ. Don't *ever*
assume that it will be a maximum size because that can result in buffer
overrun attacks.
Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]