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); }
internal static unsafe SafeEvpPKeyHandle DecodePkcs8PrivateKey( ReadOnlySpan <byte> source, EvpAlgorithmId algorithmId) { SafeEvpPKeyHandle handle; fixed(byte *sourcePtr = source) { handle = CryptoNative_DecodePkcs8PrivateKey( sourcePtr, source.Length, (int)algorithmId); } if (handle.IsInvalid) { handle.Dispose(); throw CreateOpenSslCryptographicException(); } return(handle); }
private static extern SafeEvpPKeyHandle CryptoNative_EvpPKeyDuplicate( SafeEvpPKeyHandle currentKey, EvpAlgorithmId algorithmId);