Exemple #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();
            }
        }
        protected override bool ReleaseHandle()
        {
            _certHandle?.Dispose();
            _certKeyHandle?.Dispose();

            _isInvalid = true;
            return(true);
        }
Exemple #3
0
        internal static SafeEvpPKeyHandle RsaGenerateKey(int keySize)
        {
            SafeEvpPKeyHandle pkey = CryptoNative_RsaGenerateKey(keySize);

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

            return(pkey);
        }
Exemple #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;
            }
        }
Exemple #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");
            }
Exemple #8
0
        protected override bool ReleaseHandle()
        {
            if (_certHandle != null)
            {
                _certHandle.Dispose();
            }

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

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

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

            _isInvalid = true;
            return(true);
        }
        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();
 }