You need to set the followiong flags like for a bitstringc containing
a public key: 

        pk->public_key->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
        pk->public_key->flags|=ASN1_STRING_FLAG_BITS_LEFT;

If not, the code assumes that a bitstring is in fact a named bit list
and removes trailing 0s. 

> 
> Hi everybody, i have a strange behavior ...

> 
> (while investigationg it i noticed that i2d_ASN1_BIT_STRING shorten a bit string if 
> there are null bytes at the end of the string which it was not doing in older 
> versions.)
> 
> But that's not why i write here :
> I upgraded a server application from an old ssleay version to a recent openssl one.
> 
> And with new one, for some odd reason, when i ASN1_sign a buffer (as 
> ASN1_BIT_STRING), the ASN1_verify will :
> * always fail if the last byte of the buffer was 0x02
> * may fail if the last byte was 0x00
> * never fail if last was 0x01 or 0x03
> 
> The application verifying is still using the ancien ssl lib.
> 
> has Anyone a clue ?
> Cause i am a bit confused on what's wrong.
> 
> Francis
> 
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    [EMAIL PROTECTED]
> Automated List Manager                           [EMAIL PROTECTED]
> 
> 
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to