w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
SignedCms.Decode() causes "ASN1 bad tag value met. "

CR and LF are no problem; the in the exception message is just part of the exception message. The real symptom is "ASN1 bad tag". That's because dotnet SignedCMS is for Cryptographic Message Syntax (CMS) data, which is way different and MUCH more complicated than a simple RSA signature as you've created. See RFC 3369 et al for details.

If you really want to use a near-raw signature (with PKCS#1 padding as nearly everybody including Java does, but not algid, entity/key identification, additional data, certs, type identification, etc.) you'll need to do something different to receive it in Csharp. I can't help with that part.

If you want to generate CMS SignedData in Java, see Sign data using PKCS #7 in JAVA (BouncyCastle) or http://security.stackexchange.com/questions/13910/pkcs7-encoding-in-java-without-external-libs-like-bouncycastle-etc (sun extension).

If you're not wedded to Java, openssl (in highly portable C) also does a good job on CMS/PKCS#7.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.