Home All Groups Group Topic Archive Search About

ASN1 unexpected end of data

Author
19 Sep 2006 2:26 PM
kplkumar
I have a message that is signed (attached) and encoded in base64 by
CAPICOM in a .NET 1.1 application.

I have a .NET 2.0 server which needs to reads this. So I did the
regular base64 decode. The I found out while debugging that the
original message is packed into a bunc of funky characters which I
assume must be the signature.

I tried using SignedCms like this,
_____________________________________________________________________________
//After base64 decoding,

UnicodeEncoding byteConverter = new UnicodeEncoding();
byte[] byteMessage = byteConverter.GetBytes(message);

SignedCms cms = new SignedCms();
cms.Decode(byteMessage); // I get error at this point "ASN1 unexpected
end of data"
cms.CheckSignature(true);

Anyone had this before??

Author
19 Sep 2006 2:54 PM
Joe Kaplan
Are you sure the binary data is unicode?  Why not just pass the
base64-derived binary data directly into the CMS message?

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
Show quoteHide quote
"kplkumar" <kplku***@gmail.com> wrote in message
news:1158675995.895468.238520@i3g2000cwc.googlegroups.com...
>I have a message that is signed (attached) and encoded in base64 by
> CAPICOM in a .NET 1.1 application.
>
> I have a .NET 2.0 server which needs to reads this. So I did the
> regular base64 decode. The I found out while debugging that the
> original message is packed into a bunc of funky characters which I
> assume must be the signature.
>
> I tried using SignedCms like this,
> _____________________________________________________________________________
> //After base64 decoding,
>
> UnicodeEncoding byteConverter = new UnicodeEncoding();
> byte[] byteMessage = byteConverter.GetBytes(message);
>
> SignedCms cms = new SignedCms();
> cms.Decode(byteMessage); // I get error at this point "ASN1 unexpected
> end of data"
> cms.CheckSignature(true);
>
> Anyone had this before??
>