Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0126f6f
Not use AppleCryptoNative_EccGenerateKey on iOS/tvOS
MaximLipnin Mar 17, 2021
6e3e61f
Not use AppleCryptoNative_SecKeychainItemCopyKeychain, AppleCryptoNat…
MaximLipnin Mar 17, 2021
1a5d5ff
Not use AppleCryptoNative_RsaGenerateKey, AppleCryptoNative_RsaEncryp…
MaximLipnin Mar 18, 2021
1763124
Not use AppleCryptoNative_SecKeyImportEphemeral, AppleCryptoNative_Ge…
MaximLipnin Mar 19, 2021
b8653b4
Rename the property and use item groups
MaximLipnin Mar 22, 2021
53121a2
Remove redundant annotation
MaximLipnin Mar 23, 2021
aa655e5
Redundant line
MaximLipnin Mar 23, 2021
d802656
Remove redundant annotations
MaximLipnin Mar 24, 2021
d1a75b8
Address the review comments
MaximLipnin Mar 25, 2021
dba0695
Suppress the analyzer warning
MaximLipnin Mar 25, 2021
09df97a
Remove redundant annotations
MaximLipnin Mar 26, 2021
87fdecd
Remove usings
MaximLipnin Mar 26, 2021
c2ed4cc
Remove using
MaximLipnin Mar 26, 2021
fbf70d4
Remove using
MaximLipnin Mar 26, 2021
c8f77ae
Remove redundant annotations
MaximLipnin Mar 29, 2021
375047f
Use warning suppression instead of attributes for PNSE throwing metho…
MaximLipnin Mar 29, 2021
293d159
Add a link to the GH issue for enabling the native operations
MaximLipnin Apr 12, 2021
0deb6be
Extract some RSA-related methods to a shared part
MaximLipnin Apr 19, 2021
b34331b
Annotate the public base class (RSA type) and derived class (RSASecur…
MaximLipnin Apr 20, 2021
17bf76c
Address a couple more warnings
MaximLipnin Apr 20, 2021
2777fe2
Exclude the RSAXmlTEest trimming test on iOS/tvOS due to the unsuppor…
MaximLipnin Apr 21, 2021
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
Add a link to the GH issue for enabling the native operations
  • Loading branch information
MaximLipnin committed Apr 21, 2021
commit 293d159fc515a19af33f251f30ea8620434f3646
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public override RSAParameters ExportParameters(bool includePrivateParameters)
throw new CryptographicException(SR.Cryptography_OpenInvalidHandle);
}

#pragma warning disable CA1416 // Validate platform compatibility, not supported on iOS/tvOS
#pragma warning disable CA1416 // https://github.com/dotnet/runtime/issues/51098
byte[] keyBlob = Interop.AppleCrypto.SecKeyExport(
includePrivateParameters ? keys.PrivateKey : keys.PublicKey,
exportPrivate: includePrivateParameters,
Expand Down Expand Up @@ -207,7 +207,7 @@ public override unsafe void ImportSubjectPublicKeyInfo(
manager.Memory,
out int localRead);

#pragma warning disable CA1416 // Validate platform compatibility, not supported on iOS/tvOS
#pragma warning disable CA1416 // https://github.com/dotnet/runtime/issues/51098
SafeSecKeyRefHandle publicKey = Interop.AppleCrypto.ImportEphemeralKey(source.Slice(0, localRead), false);
#pragma warning restore CA1416
SetKey(SecKeyPair.PublicOnly(publicKey));
Expand Down Expand Up @@ -320,7 +320,7 @@ public override bool TryEncrypt(ReadOnlySpan<byte> data, Span<byte> destination,
SR.Format(SR.Cryptography_Encryption_MessageTooLong, maxAllowed));
}

#pragma warning disable CA1416 // Validate platform compatibility, not supported on iOS/tvOS
#pragma warning disable CA1416 // https://github.com/dotnet/runtime/issues/51098
return Interop.AppleCrypto.TryRsaEncrypt(
GetKeys().PublicKey,
data,
Expand Down Expand Up @@ -399,7 +399,7 @@ public override byte[] Decrypt(byte[] data, RSAEncryptionPadding padding)

if (padding.Mode == RSAEncryptionPaddingMode.Pkcs1)
{
#pragma warning disable CA1416 // Validate platform compatibility, not supported on iOS/tvOS
#pragma warning disable CA1416 // https://github.com/dotnet/runtime/issues/51098
return Interop.AppleCrypto.RsaDecrypt(keys.PrivateKey, data, padding);
#pragma warning restore CA1416
}
Expand Down Expand Up @@ -467,7 +467,7 @@ private bool TryDecrypt(
if (padding.Mode == RSAEncryptionPaddingMode.Pkcs1 ||
padding == RSAEncryptionPadding.OaepSHA1)
{
#pragma warning disable CA1416 // Validate platform compatibility, not supported on iOS/tvOS
#pragma warning disable CA1416 // https://github.com/dotnet/runtime/issues/51098
return Interop.AppleCrypto.TryRsaDecrypt(privateKey, data, destination, padding, out bytesWritten);
#pragma warning restore CA1416
}
Expand Down Expand Up @@ -533,7 +533,7 @@ public override byte[] SignHash(byte[] hash, HashAlgorithmName hashAlgorithm, RS
hashAlgorithm.Name));
}

#pragma warning disable CA1416 // Validate platform compatibility, not supported on iOS/tvOS
#pragma warning disable CA1416 // https://github.com/dotnet/runtime/issues/51098
return Interop.AppleCrypto.GenerateSignature(
keys.PrivateKey,
hash,
Expand Down Expand Up @@ -612,7 +612,7 @@ public override bool TrySignHash(ReadOnlySpan<byte> hash, Span<byte> destination
return false;
}

#pragma warning disable CA1416 // Validate platform compatibility, not supported on iOS/tvOS
#pragma warning disable CA1416 // https://github.com/dotnet/runtime/issues/51098
return Interop.AppleCrypto.TryGenerateSignature(
keys.PrivateKey,
hash,
Expand Down Expand Up @@ -680,7 +680,7 @@ public override bool VerifyHash(ReadOnlySpan<byte> hash, ReadOnlySpan<byte> sign
{
Interop.AppleCrypto.PAL_HashAlgorithm palAlgId =
PalAlgorithmFromAlgorithmName(hashAlgorithm, out int expectedSize);
#pragma warning disable CA1416 // Validate platform compatibility, not supported on iOS/tvOS
#pragma warning disable CA1416 // https://github.com/dotnet/runtime/issues/51098
return Interop.AppleCrypto.VerifySignature(GetKeys().PublicKey, hash, signature, palAlgId);
#pragma warning restore CA1416
}
Expand Down Expand Up @@ -809,7 +809,7 @@ internal SecKeyPair GetKeys()
SafeSecKeyRefHandle publicKey;
SafeSecKeyRefHandle privateKey;

#pragma warning disable CA1416 // Validate platform compatibility, not supported on iOS/tvOS
#pragma warning disable CA1416 // https://github.com/dotnet/runtime/issues/51098
Interop.AppleCrypto.RsaGenerateKey(KeySizeValue, out publicKey, out privateKey);
#pragma warning restore CA1416
current = SecKeyPair.PublicPrivatePair(publicKey, privateKey);
Expand Down Expand Up @@ -860,7 +860,7 @@ private static SafeSecKeyRefHandle ImportKey(RSAParameters parameters)

try
{
#pragma warning disable CA1416 // Validate platform compatibility, not supported on iOS/tvOS
#pragma warning disable CA1416 // https://github.com/dotnet/runtime/issues/51098
return Interop.AppleCrypto.ImportEphemeralKey(rented.AsSpan(0, written), hasPrivateKey);
#pragma warning restore CA1416
}
Expand Down