On Tue, Oct 29, 2013, cellecial wrote:

> 
> I have a problem with i2d_ASN1_BIT_STRING().
> If I set data with a 0x00-terminated string , i2d_ASN1_BIT_STRING() will
> trim off 0x00.
> 

Usually a BIT STRING is a, err, string of bits and DER dictates that trailing
zero bits are removed. In some cases it is used as a container for something
else but you need to indicate this by setting some flags:

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

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [email protected]

Reply via email to