I am trying to implement a SCEP service, my experience with cryptography++ is quite limited so this has been an uphill battle. Currently I am accepting a certificate request from a client, and I am working de interpret the request. The certificate request should be in the form of a CMS/PKCS#7, however I am having great difficulties interpreting it:
- When using the ASN.1 edtor at http://lipingshare.com/Asn1Editor/ I just get "Failed to read data".
- When using 'openssl asn1parse -inform DER < bytes' on Linux I get something which seems quite sensible. The application should run on Windows .NET so the detr into linux was mainly one of despair.
Trying to decode in .NET fails:
byte[] data = Convert.FromBase64String( input_message );
SignedCms signerInfo = new SignedCms();
EnvelopedCms contentInfo = new EnvelopedCms();
signerInfo.decode(data);
contentInfo.Decode( signerInfo.ContentInfo.Content );
contentInfo.Decrypt();[*][*]: This fails with a CryptographicException and message: "Cannot find object or property".
Trying to decode with BouncyCastle .NET classes fails:
byte[] data = Convert.FromBase64String( input_message );
Org.BouncyCastle.Cms.CmsSignedData signedData = new CmsDignedData( data );
Org.BouncyCastle.Cms.CmsEnvelopedData ed = new CmsEnvelopedData( signedD.ContentInfo);[*][*] This fails with "ArgumentException" and message: "unknown object in factor: BerTaggedObject".
I realize this does not satisfy StackOverflows requirements of a clear and concise question; but I guess that just reflects the lack of clearness on my side :-( Basically I would be very grateful for any tips on how to to interpret a SCEP message (CMS/PKCS#7) in .NET, using either standard Windows classes or the BouncyCastle API; but to conclude with some concrete questions:
- Can I infer something from the fact that asn1parse on Linux seems to handle my message, whereas the Lipingshare Asn.1 editor fails?
- The SCEP standards says that the CMS message should be BER encoded; whereas the asn1parse programs takes a '-inform DER' switch (and still works...), and the BouncyCastle class seems to complain about a BERTaggedObject.
Grateful for any ideas, thoughts or suggestions.
Joakim