Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ namespace System.Security.Cryptography
{
internal static partial class ECDiffieHellmanImplementation
{
public sealed partial class ECDiffieHellmanSecurityTransforms : ECDiffieHellman
public sealed partial class ECDiffieHellmanAppleCrypto : ECDiffieHellman
{
private readonly EccSecurityTransforms _ecc = new EccSecurityTransforms(typeof(ECDiffieHellman));
private readonly EccAppleCrypto _ecc = new EccAppleCrypto(typeof(ECDiffieHellman));

public ECDiffieHellmanSecurityTransforms()
public ECDiffieHellmanAppleCrypto()
{
base.KeySize = 521;
}

internal ECDiffieHellmanSecurityTransforms(SafeSecKeyRefHandle publicKey)
internal ECDiffieHellmanAppleCrypto(SafeSecKeyRefHandle publicKey)
{
KeySizeValue = _ecc.SetKeyAndGetSize(SecKeyPair.PublicOnly(publicKey));
}

internal ECDiffieHellmanSecurityTransforms(SafeSecKeyRefHandle publicKey, SafeSecKeyRefHandle privateKey)
internal ECDiffieHellmanAppleCrypto(SafeSecKeyRefHandle publicKey, SafeSecKeyRefHandle privateKey)
{
KeySizeValue = _ecc.SetKeyAndGetSize(SecKeyPair.PublicPrivatePair(publicKey, privateKey));
}
Expand Down Expand Up @@ -177,10 +177,10 @@ public override byte[] DeriveRawSecretAgreement(ECDiffieHellmanPublicKey otherPa

private byte[]? DeriveSecretAgreement(ECDiffieHellmanPublicKey otherPartyPublicKey, IncrementalHash? hasher)
{
if (!(otherPartyPublicKey is ECDiffieHellmanSecurityTransformsPublicKey secTransPubKey))
if (!(otherPartyPublicKey is ECDiffieHellmanAppleCryptoPublicKey secTransPubKey))
{
secTransPubKey =
new ECDiffieHellmanSecurityTransformsPublicKey(otherPartyPublicKey.ExportParameters());
new ECDiffieHellmanAppleCryptoPublicKey(otherPartyPublicKey.ExportParameters());
}

try
Expand Down Expand Up @@ -244,16 +244,16 @@ public override byte[] DeriveRawSecretAgreement(ECDiffieHellmanPublicKey otherPa
}

public override ECDiffieHellmanPublicKey PublicKey =>
new ECDiffieHellmanSecurityTransformsPublicKey(ExportParameters(false));
new ECDiffieHellmanAppleCryptoPublicKey(ExportParameters(false));

private sealed class ECDiffieHellmanSecurityTransformsPublicKey : ECDiffieHellmanPublicKey
private sealed class ECDiffieHellmanAppleCryptoPublicKey : ECDiffieHellmanPublicKey
{
private readonly EccSecurityTransforms _ecc;
private readonly EccAppleCrypto _ecc;

public ECDiffieHellmanSecurityTransformsPublicKey(ECParameters ecParameters)
public ECDiffieHellmanAppleCryptoPublicKey(ECParameters ecParameters)
{
Debug.Assert(ecParameters.D == null);
_ecc = new EccSecurityTransforms(typeof(ECDiffieHellmanPublicKey));
_ecc = new EccAppleCrypto(typeof(ECDiffieHellmanPublicKey));
_ecc.ImportParameters(ecParameters);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ namespace System.Security.Cryptography
{
internal static partial class ECDsaImplementation
{
public sealed partial class ECDsaSecurityTransforms : ECDsa, IRuntimeAlgorithm
public sealed partial class ECDsaAppleCrypto : ECDsa, IRuntimeAlgorithm
{
private readonly EccSecurityTransforms _ecc = new EccSecurityTransforms(typeof(ECDsa));
private readonly EccAppleCrypto _ecc = new EccAppleCrypto(typeof(ECDsa));

public ECDsaSecurityTransforms()
public ECDsaAppleCrypto()
{
base.KeySize = 521;
}

internal ECDsaSecurityTransforms(SafeSecKeyRefHandle publicKey)
internal ECDsaAppleCrypto(SafeSecKeyRefHandle publicKey)
{
KeySizeValue = _ecc.SetKeyAndGetSize(SecKeyPair.PublicOnly(publicKey));
}

internal ECDsaSecurityTransforms(SafeSecKeyRefHandle publicKey, SafeSecKeyRefHandle privateKey)
internal ECDsaAppleCrypto(SafeSecKeyRefHandle publicKey, SafeSecKeyRefHandle privateKey)
{
KeySizeValue = _ecc.SetKeyAndGetSize(SecKeyPair.PublicPrivatePair(publicKey, privateKey));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

namespace System.Security.Cryptography
{
internal sealed partial class EccSecurityTransforms : IDisposable
internal sealed partial class EccAppleCrypto : IDisposable
{
private SecKeyPair? _keys;
private bool _disposed;
private readonly Type _disposedType;

internal EccSecurityTransforms(Type disposedType)
internal EccAppleCrypto(Type disposedType)
{
Debug.Assert(disposedType != null);
_disposedType = disposedType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace System.Security.Cryptography
{
internal sealed partial class EccSecurityTransforms
internal sealed partial class EccAppleCrypto
{
#pragma warning disable IDE0060
private static ECParameters ExportParametersFromLegacyKey(SecKeyPair keys, bool includePrivateParameters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace System.Security.Cryptography
{
internal sealed partial class EccSecurityTransforms
internal sealed partial class EccAppleCrypto
{
private static ECParameters ExportParametersFromLegacyKey(SecKeyPair keys, bool includePrivateParameters)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace System.Security.Cryptography
{
internal static partial class RSAImplementation
{
public sealed partial class RSASecurityTransforms : RSA, IRuntimeAlgorithm
public sealed partial class RSAAppleCrypto : RSA, IRuntimeAlgorithm
{
private SecKeyPair? _keys;

Expand All @@ -24,22 +24,22 @@ public sealed partial class RSASecurityTransforms : RSA, IRuntimeAlgorithm
// 8192 generated successfully, 8192+8 produced errSecParam.
private static readonly KeySizes s_legalKeySize = new KeySizes(minSize: 1024, maxSize: 8192, skipSize: 8);

public RSASecurityTransforms()
public RSAAppleCrypto()
: this(2048)
{
}

public RSASecurityTransforms(int keySize)
public RSAAppleCrypto(int keySize)
{
base.KeySize = keySize;
}

internal RSASecurityTransforms(SafeSecKeyRefHandle publicKey)
internal RSAAppleCrypto(SafeSecKeyRefHandle publicKey)
{
SetKey(SecKeyPair.PublicOnly(publicKey));
}

internal RSASecurityTransforms(SafeSecKeyRefHandle publicKey, SafeSecKeyRefHandle privateKey)
internal RSAAppleCrypto(SafeSecKeyRefHandle publicKey, SafeSecKeyRefHandle privateKey)
{
SetKey(SecKeyPair.PublicPrivatePair(publicKey, privateKey));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace System.Security.Cryptography
{
internal static partial class RSAImplementation
{
public sealed partial class RSASecurityTransforms
public sealed partial class RSAAppleCrypto
{
#pragma warning disable IDE0060
private static RSAParameters ExportParametersFromLegacyKey(SecKeyPair keys, bool includePrivateParameters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace System.Security.Cryptography
{
internal static partial class RSAImplementation
{
public sealed partial class RSASecurityTransforms : RSA
public sealed partial class RSAAppleCrypto : RSA
{
private static RSAParameters ExportParametersFromLegacyKey(SecKeyPair keys, bool includePrivateParameters)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1364,22 +1364,22 @@
Link="Common\Microsoft\Win32\SafeHandles\SafeCreateHandle.OSX.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\CompositeMLDsaImplementation.NotSupported.cs"
Link="Common\System\Security\Cryptography\CompositeMLDsaImplementation.NotSupported.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\EccSecurityTransforms.cs"
Link="Common\System\Security\Cryptography\EccSecurityTransforms.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\EccAppleCrypto.cs"
Link="Common\System\Security\Cryptography\EccAppleCrypto.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\ECDiffieHellmanDerivation.cs"
Link="Common\System\Security\Cryptography\ECDiffieHellmanDerivation.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\ECDiffieHellmanSecurityTransforms.cs"
Link="Common\System\Security\Cryptography\ECDiffieHellmanSecurityTransforms.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\ECDsaSecurityTransforms.cs"
Link="Common\System\Security\Cryptography\ECDsaSecurityTransforms.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\ECDiffieHellmanAppleCrypto.cs"
Link="Common\System\Security\Cryptography\ECDiffieHellmanAppleCrypto.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\ECDsaAppleCrypto.cs"
Link="Common\System\Security\Cryptography\ECDsaAppleCrypto.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\MLDsaImplementation.NotSupported.cs"
Link="Common\System\Security\Cryptography\MLDsaImplementation.NotSupported.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\MLKemImplementation.cs"
Link="Common\System\Security\Cryptography\MLKemImplementation.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\MLKemImplementation.NotSupported.cs"
Link="Common\System\Security\Cryptography\MLKemImplementation.NotSupported.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\RSASecurityTransforms.cs"
Link="Common\System\Security\Cryptography\RSASecurityTransforms.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\RSAAppleCrypto.cs"
Link="Common\System\Security\Cryptography\RSAAppleCrypto.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\SlhDsaImplementation.NotSupported.cs"
Link="Common\System\Security\Cryptography\SlhDsaImplementation.NotSupported.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\SP800108HmacCounterKdfImplementationManaged.cs"
Expand All @@ -1400,8 +1400,8 @@
<Compile Include="System\Security\Cryptography\CspKeyContainerInfo.NotSupported.cs" />
<Compile Include="System\Security\Cryptography\DESCryptoServiceProvider.Unix.cs" />
<Compile Include="System\Security\Cryptography\DesImplementation.Apple.cs" />
<Compile Include="System\Security\Cryptography\ECDiffieHellman.Create.SecurityTransforms.cs" />
<Compile Include="System\Security\Cryptography\ECDsa.Create.SecurityTransforms.cs" />
<Compile Include="System\Security\Cryptography\ECDiffieHellman.Create.AppleCrypto.cs" />
<Compile Include="System\Security\Cryptography\ECDsa.Create.AppleCrypto.cs" />
<Compile Include="System\Security\Cryptography\HashAlgorithmNames.Apple.cs" />
<Compile Include="System\Security\Cryptography\HashProviderDispenser.Apple.cs" />
<Compile Include="System\Security\Cryptography\HKDF.Managed.cs" />
Expand All @@ -1416,7 +1416,7 @@
<Compile Include="System\Security\Cryptography\RandomNumberGeneratorImplementation.Apple.cs" />
<Compile Include="System\Security\Cryptography\RC2CryptoServiceProvider.Unix.cs" />
<Compile Include="System\Security\Cryptography\RC2Implementation.Apple.cs" />
<Compile Include="System\Security\Cryptography\RSA.Create.SecurityTransforms.cs" />
<Compile Include="System\Security\Cryptography\RSA.Create.AppleCrypto.cs" />
<Compile Include="System\Security\Cryptography\RSACryptoServiceProvider.Unix.cs" />
<Compile Include="System\Security\Cryptography\Shake128.NonWindows.cs" />
<Compile Include="System\Security\Cryptography\Shake256.NonWindows.cs" />
Expand Down Expand Up @@ -1450,10 +1450,10 @@
Link="Common\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.SecKeyRef.macOS.cs" />
<Compile Include="$(CommonPath)Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.X509.macOS.cs"
Link="Common\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.X509.macOS.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\EccSecurityTransforms.macOS.cs"
Link="Common\System\Security\Cryptography\EccSecurityTransforms.macOS.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\RSASecurityTransforms.macOS.cs"
Link="Common\System\Security\Cryptography\RSASecurityTransforms.macOS.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\EccAppleCrypto.macOS.cs"
Link="Common\System\Security\Cryptography\EccAppleCrypto.macOS.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\RSAAppleCrypto.macOS.cs"
Link="Common\System\Security\Cryptography\RSAAppleCrypto.macOS.cs" />
<Compile Include="System\Security\Cryptography\AesCcm.NotSupported.cs" />
<Compile Include="System\Security\Cryptography\DSA.Create.NotSupported.cs" />
<Compile Include="System\Security\Cryptography\DSACryptoServiceProvider.Unix.cs" />
Expand All @@ -1475,10 +1475,10 @@
Link="Common\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.Keychain.iOS.cs" />
<Compile Include="$(CommonPath)Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.X509.iOS.cs"
Link="Common\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.X509.iOS.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\EccSecurityTransforms.iOS.cs"
Link="Common\System\Security\Cryptography\EccSecurityTransforms.iOS.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\RSASecurityTransforms.iOS.cs"
Link="Common\System\Security\Cryptography\RSASecurityTransforms.iOS.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\EccAppleCrypto.iOS.cs"
Link="Common\System\Security\Cryptography\EccAppleCrypto.iOS.cs" />
<Compile Include="$(CommonPath)System\Security\Cryptography\RSAAppleCrypto.iOS.cs"
Link="Common\System\Security\Cryptography\RSAAppleCrypto.iOS.cs" />
<Compile Include="System\Security\Cryptography\AesCcm.NotSupported.cs" />
<Compile Include="System\Security\Cryptography\DSA.Create.NotSupported.cs" />
<Compile Include="System\Security\Cryptography\DSACryptoServiceProvider.NotSupported.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public abstract partial class ECDiffieHellman : ECAlgorithm
{
public static new partial ECDiffieHellman Create()
{
return new ECDiffieHellmanImplementation.ECDiffieHellmanSecurityTransforms();
return new ECDiffieHellmanImplementation.ECDiffieHellmanAppleCrypto();
}

public static partial ECDiffieHellman Create(ECCurve curve)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public partial class ECDsa : ECAlgorithm
/// </summary>
public static new partial ECDsa Create()
{
return new ECDsaImplementation.ECDsaSecurityTransforms();
return new ECDsaImplementation.ECDsaAppleCrypto();
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public partial class RSA : AsymmetricAlgorithm
{
public static new partial RSA Create()
{
return new RSAImplementation.RSASecurityTransforms();
return new RSAImplementation.RSAAppleCrypto();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public override int KeySize
set { _impl.KeySize = value; }
}

// RSAOpenSsl is (512, 16384, 8), RSASecurityTransforms is (1024, 16384, 8)
// RSAOpenSsl is (512, 16384, 8), RSAAppleCrypto is (1024, 16384, 8)
// Either way the minimum is lifted off of CAPI's 384, due to platform constraints.
public override KeySizes[] LegalKeySizes => _impl.LegalKeySizes;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public ICertificatePal CopyWithPrivateKey(DSA privateKey)

public ICertificatePal CopyWithPrivateKey(ECDsa privateKey)
{
var typedKey = privateKey as ECDsaImplementation.ECDsaSecurityTransforms;
var typedKey = privateKey as ECDsaImplementation.ECDsaAppleCrypto;
byte[] ecPrivateKey;

if (typedKey != null)
Expand Down Expand Up @@ -61,7 +61,7 @@ public ICertificatePal CopyWithPrivateKey(ECDsa privateKey)

public ICertificatePal CopyWithPrivateKey(ECDiffieHellman privateKey)
{
var typedKey = privateKey as ECDiffieHellmanImplementation.ECDiffieHellmanSecurityTransforms;
var typedKey = privateKey as ECDiffieHellmanImplementation.ECDiffieHellmanAppleCrypto;
byte[] ecPrivateKey;

if (typedKey != null)
Expand Down Expand Up @@ -102,7 +102,7 @@ public ICertificatePal CopyWithPrivateKey(MLDsa privateKey)

public ICertificatePal CopyWithPrivateKey(RSA privateKey)
{
var typedKey = privateKey as RSAImplementation.RSASecurityTransforms;
var typedKey = privateKey as RSAImplementation.RSAAppleCrypto;

if (typedKey != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public byte[] SubjectPublicKeyInfo
privateKey.SetParentHandle(_certHandle);
Debug.Assert(!publicKey.IsInvalid);

return new RSAImplementation.RSASecurityTransforms(publicKey, privateKey);
return new RSAImplementation.RSAAppleCrypto(publicKey, privateKey);
}

public ECDsa? GetECDsaPrivateKey()
Expand All @@ -347,7 +347,7 @@ public byte[] SubjectPublicKeyInfo
privateKey.SetParentHandle(_certHandle);
Debug.Assert(!publicKey.IsInvalid);

return new ECDsaImplementation.ECDsaSecurityTransforms(publicKey, privateKey);
return new ECDsaImplementation.ECDsaAppleCrypto(publicKey, privateKey);
}

public ECDiffieHellman? GetECDiffieHellmanPrivateKey()
Expand All @@ -361,7 +361,7 @@ public byte[] SubjectPublicKeyInfo
privateKey.SetParentHandle(_certHandle);
Debug.Assert(!publicKey.IsInvalid);

return new ECDiffieHellmanImplementation.ECDiffieHellmanSecurityTransforms(publicKey, privateKey);
return new ECDiffieHellmanImplementation.ECDiffieHellmanAppleCrypto(publicKey, privateKey);
}

public MLDsa? GetMLDsaPrivateKey()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ private static partial Pkcs12Return FromCertAndKey(CertAndKey certAndKey, Import
case Oids.Rsa or Oids.RsaPss:
return new AsymmetricAlgorithmPkcs12PrivateKey(
pkcs8,
static () => new RSAImplementation.RSASecurityTransforms());
static () => new RSAImplementation.RSAAppleCrypto());
case Oids.EcPublicKey or Oids.EcDiffieHellman:
return new AsymmetricAlgorithmPkcs12PrivateKey(
pkcs8,
static () => new ECDsaImplementation.ECDsaSecurityTransforms());
static () => new ECDsaImplementation.ECDsaAppleCrypto());

default:
// No DSA or PQC support on iOS / tvOS.
Expand Down
Loading
Loading