Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
        protected override bool ReleaseHandle()
        {
            _certHandle?.Dispose();
            _certKeyHandle?.Dispose();

            _isInvalid = true;
            return(true);
        }
Exemplo n.º 3
0
        internal static SafeEvpPKeyHandle RsaGenerateKey(int keySize)
        {
            SafeEvpPKeyHandle pkey = CryptoNative_RsaGenerateKey(keySize);

            if (pkey.IsInvalid)
            {
                pkey.Dispose();
                throw CreateOpenSslCryptographicException();
            }

            return(pkey);
        }
Exemplo n.º 4
0
            public void Dispose()
            {
                _gcHandle.Free();
                if (_privateKeyHandle != null)
                {
                    _privateKeyHandle.Dispose();
                }

                if (_certHandle != null)
                {
                    _certHandle.Dispose();
                }
            }
        public void Dispose()
        {
            if (_privateKey != null)
            {
                _privateKey.Dispose();
                _privateKey = null;
            }

            if (_cert != null)
            {
                _cert.Dispose();
                _cert = null;
            }
        }
Exemplo n.º 6
0
        internal static SafeEvpPKeyHandle EvpPKeyCreateRsa(IntPtr rsa)
        {
            Debug.Assert(rsa != IntPtr.Zero);

            SafeEvpPKeyHandle pkey = CryptoNative_EvpPKeyCreateRsa(rsa);

            if (pkey.IsInvalid)
            {
                pkey.Dispose();
                throw CreateOpenSslCryptographicException();
            }

            return(pkey);
        }
            public void Dispose()
            {
                _gcHandle.Free();
                if (_privateKeyHandle != null)
                {
                    _privateKeyHandle.Dispose();
                }

                if (_certHandle != null)
                {
                    _certHandle.Dispose();
                }
                VerboseTrace("Disposed client cert provider");
            }
Exemplo n.º 8
0
        protected override bool ReleaseHandle()
        {
            if (_certHandle != null)
            {
                _certHandle.Dispose();
            }

            if (_certKeyHandle != null)
            {
                _certKeyHandle.Dispose();
            }

            _protocols = SslProtocols.None;
            return(true);
        }
Exemplo n.º 9
0
        protected override bool ReleaseHandle()
        {
            if (_certHandle != null)
            {
                _certHandle.Dispose();
            }

            if (_certKeyHandle != null)
            {
                _certKeyHandle.Dispose();
            }

            _isInvalid = true;
            return(true);
        }
Exemplo n.º 10
0
        internal static SafeEvpPKeyHandle EvpPKeyDuplicate(
            SafeEvpPKeyHandle currentKey,
            EvpAlgorithmId algorithmId)
        {
            Debug.Assert(!currentKey.IsInvalid);

            SafeEvpPKeyHandle pkey = CryptoNative_EvpPKeyDuplicate(
                currentKey,
                algorithmId);

            if (pkey.IsInvalid)
            {
                pkey.Dispose();
                throw CreateOpenSslCryptographicException();
            }

            return(pkey);
        }
 public void Dispose()
 {
     _gcHandle.Free();
     _privateKeyHandle?.Dispose();
     _certHandle?.Dispose();
 }