On Tue, Jan 19, 2010, Ujwal Chinthala wrote:

> Hi,
> 
> I am new to OpenSSL.
> 
> I am trying to verify the compressed XML data, signed using PKCS#7. Then a 
> four byte crc is appended to it and the whole data is now base64 encoded.
> All the above is done using windows libraries. The verification works fine in 
> windows.
> 
> Now I am trying to verify the above data(signed using windows libs) using 
> OpenSSL.
> 
> The data is decoded from base64 to bytes, crc is verified. Then I try to use 
> the command d2i_pkcs7 to create the PKCS7 structure which results in
> the following error , error:0D0680A8:asn1 encoding 
> routines:ASN1_CHECK_TLEN:wrong tag.
> 
> The code I am using to do this is as follows:
> 
> const unsigned char *q;
>       q = (const unsigned char*)nBytes;
>       PKCS7 *p7 = NULL; // I want to use this p7 structure in PKCS7_verify
>       p7 = d2i_PKCS7(NULL, &q, nCountOfBytes);// error occurs here
> 
> 
> where nBytes is a BYTE array storing the data. I don't have a clue what this 
> error means, am I missing something here?
> 

I suspect that is caused by the binary data being corrupted somehow. For
example the base64 data not being decoded correctly or it not being in DER
format. What does the data look like? Is it ASCII text or are the first two
characters 0x30, 0x82?

Suggest you dump the binary data to a file and try:

openssl pkcs7 -inform DER -in file.p7

If you get a similar error and the above doesn't help you could send it to me
and I'll take a look.

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                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to