private void FreeKey() { if (_key != null && _key.IsValueCreated) { SafeDsaHandle handle = _key.Value; if (handle != null) { handle.Dispose(); } } }
public DSAOpenSsl(SafeEvpPKeyHandle pkeyHandle) { ArgumentNullException.ThrowIfNull(pkeyHandle); if (pkeyHandle.IsInvalid) { throw new ArgumentException(SR.Cryptography_OpenInvalidHandle, nameof(pkeyHandle)); } ThrowIfNotSupported(); // If dsa is valid it has already been up-ref'd, so we can just use this handle as-is. SafeDsaHandle key = Interop.Crypto.EvpPkeyGetDsa(pkeyHandle); if (key.IsInvalid) { key.Dispose(); throw Interop.Crypto.CreateOpenSslCryptographicException(); } SetKey(key); }