title: OpenSSL.NET can't export private key with null Cipher
body: <p>I've recently discovered <a href="http://sourceforge.net/projects/openssl-net/" rel="nofollow noreferrer">OpenSSL.NET</a> and it's a pretty sweet little wrapper.</p>
  
  <p>I'm trying to execute the following code:</p>
  
  <pre><code>    public static void DoSomething(byte[] buf)
      {
          OpenSSL.Core.BIO input = new OpenSSL.Core.BIO(buf);
          OpenSSL.X509.X509Certificate b = OpenSSL.X509.X509Certificate.FromPKCS12(input, "passphrase");
          OpenSSL.Core.BIO outs = OpenSSL.Core.BIO.MemoryBuffer(false);
          b.PrivateKey.WritePrivateKey(outs, OpenSSL.Crypto.Cipher.Null, "passphrase");
          outs.SetClose(OpenSSL.Core.BIO.CloseOption.Close);
          Console.WriteLine(outs.ReadString());
      }
  </code></pre>
  
  <p>Problem comes at the "b.PrivateKey.WritePrivateKey(.." line.  I want to write the private key out without any encryption.  According to spec, if I use a Null cipher type this should do the trick, but it never works, regardless of the cert I use in buf.</p>
  
  <p>Here's the exception:</p>
  
  <p>error:0D0A706C:asn1 encoding routines:PKCS5_pbe2_set:cipher has no object identifier
  error:2307D00D:PKCS12 routines:PKCS8_encrypt:ASN1 lib</p>
  
  <p>I know this part works fine because if I specify any other cipher type, it exports the private key without fail.  Anyone have any suggestions?</p>