public void Dispose() { if (_caStackHandle != null) { _caStackHandle.Dispose(); _caStackHandle = null; } if (_x509Handle != null) { _x509Handle.Dispose(); _x509Handle = null; } if (_evpPkeyHandle != null) { _evpPkeyHandle.Dispose(); _evpPkeyHandle = null; } if (_pkcs12Handle != null) { _pkcs12Handle.Dispose(); } }
internal static extern SafePkcs12Handle PKCS12_create( string pass, string name, SafeEvpPKeyHandle pkey, SafeX509Handle cert, SafeX509StackHandle ca, int nid_key, int nid_cert, int iter, int mac_iter, int keytype);
private static void PushHandle(IntPtr certPtr, SafeX509StackHandle publicCerts) { using (SafeX509Handle certHandle = Interop.Crypto.X509UpRef(certPtr)) { if (!Interop.Crypto.PushX509StackField(publicCerts, certHandle)) { throw Interop.Crypto.CreateOpenSslCryptographicException(); } // The handle ownership has been transferred into the STACK_OF(X509). certHandle.SetHandleAsInvalid(); } }
internal static extern IntPtr GetX509StackField(SafeX509StackHandle stack, int loc);
internal static extern int GetX509StackFieldCount(SafeX509StackHandle stack);
internal static extern bool Pkcs12Parse( SafePkcs12Handle p12, string pass, out SafeEvpPKeyHandle pkey, out SafeX509Handle cert, out SafeX509StackHandle ca);
internal static extern SafePkcs12Handle Pkcs12Create( string pass, SafeEvpPKeyHandle pkey, SafeX509Handle cert, SafeX509StackHandle ca);