Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 1st, 2012  |  syntax: None  |  size: 0.53 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Convert PEM certificate to DER
  2. private X509CertificateStructure(
  3.         Asn1Sequence seq)
  4.     {
  5.         if (seq.Count != 3)
  6.             throw new ArgumentException("sequence wrong size for a certificate", "seq");
  7.  
  8.         //
  9.         // correct x509 certficate
  10.         //
  11.         tbsCert = TbsCertificateStructure.GetInstance(seq[0]);
  12.         sigAlgID = AlgorithmIdentifier.GetInstance(seq[1]);
  13.         sig = DerBitString.GetInstance(seq[2]);
  14.     }
  15.        
  16. openssl pkcs7 -in "C:foobar.p7b" -inform PEM -out "C:foobar_out.p7b" -outform DER