Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make the S.S.C.OpenSsl library work again
  • Loading branch information
bartonjs committed Jun 16, 2021
commit 2f75b096e5cd46123efcd37bb1db0bbc47757eb1
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ internal static partial class Interop
{
internal static partial class Crypto
{
[DllImport(Libraries.CryptoNative)]
private static extern SafeEvpPKeyHandle CryptoNative_EvpPKeyCreateRsa(IntPtr rsa);

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;
}

[DllImport(Libraries.CryptoNative)]
private static extern SafeEvpPKeyHandle CryptoNative_RsaGenerateKey(int keySize);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,30 @@ internal static partial class Crypto
[DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_EvpPkeyCreate")]
internal static extern SafeEvpPKeyHandle EvpPkeyCreate();

[DllImport(Libraries.CryptoNative)]
private static extern SafeEvpPKeyHandle CryptoNative_EvpPKeyDuplicate(
SafeEvpPKeyHandle currentKey,
EvpAlgorithmId algorithmId);

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;
}

[DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_EvpPkeyDestroy")]
internal static extern void EvpPkeyDestroy(IntPtr pkey);

Expand Down
Loading