Skip to content

Commit

Permalink
Rename EdDA to EdDsa (Azure#32380)
Browse files Browse the repository at this point in the history
  • Loading branch information
heaths authored Nov 8, 2022
1 parent 43e0723 commit 00c06ee
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- Added `KeyClient.CreateOkpKey` and `CreateOkpKeyAsync` to create an Octet Key Pair (OKP) on Managed HSM.
- Added `KeyType.Okp` and `KeyType.OkpHsm` for `JsonWebKey`.
- Added `KeyCurveName.Ed25519` to create an Octet Key Pair (OKP) using the Ed25519 curve.
- Added `SignatureAlgorithm.EdDSA` to support signing and verifying with an Octet Key Pair (OKP) on Managed HSM.
- Added `SignatureAlgorithm.EdDsa` to support signing and verifying using an Edwards Curve Digital Signature Algorithm (EdDSA) on Managed HSM.

### Breaking Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ public LocalCryptographyClientOptions() { }
private readonly object _dummy;
private readonly int _dummyPrimitive;
public SignatureAlgorithm(string value) { throw null; }
public static Azure.Security.KeyVault.Keys.Cryptography.SignatureAlgorithm EdDSA { get { throw null; } }
public static Azure.Security.KeyVault.Keys.Cryptography.SignatureAlgorithm EdDsa { get { throw null; } }
public static Azure.Security.KeyVault.Keys.Cryptography.SignatureAlgorithm ES256 { get { throw null; } }
public static Azure.Security.KeyVault.Keys.Cryptography.SignatureAlgorithm ES256K { get { throw null; } }
public static Azure.Security.KeyVault.Keys.Cryptography.SignatureAlgorithm ES384 { get { throw null; } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ public virtual VerifyResult Verify(SignatureAlgorithm algorithm, byte[] digest,
/// <list type="bullet">
/// <item>
/// <term><see cref="SHA256"/></term>
/// <description><see cref="SignatureAlgorithm.EdDSA"/>, <see cref="SignatureAlgorithm.ES256"/>, <see cref="SignatureAlgorithm.ES256K"/>, <see cref="SignatureAlgorithm.PS256"/>, <see cref="SignatureAlgorithm.RS256"/></description>
/// <description><see cref="SignatureAlgorithm.EdDsa"/>, <see cref="SignatureAlgorithm.ES256"/>, <see cref="SignatureAlgorithm.ES256K"/>, <see cref="SignatureAlgorithm.PS256"/>, <see cref="SignatureAlgorithm.RS256"/></description>
/// </item>
/// <item>
/// <term><see cref="SHA384"/></term>
Expand Down Expand Up @@ -1051,7 +1051,7 @@ public virtual async Task<SignResult> SignDataAsync(SignatureAlgorithm algorithm
/// <list type="bullet">
/// <item>
/// <term><see cref="SHA256"/></term>
/// <description><see cref="SignatureAlgorithm.EdDSA"/>, <see cref="SignatureAlgorithm.ES256"/>, <see cref="SignatureAlgorithm.ES256K"/>, <see cref="SignatureAlgorithm.PS256"/>, <see cref="SignatureAlgorithm.RS256"/></description>
/// <description><see cref="SignatureAlgorithm.EdDsa"/>, <see cref="SignatureAlgorithm.ES256"/>, <see cref="SignatureAlgorithm.ES256K"/>, <see cref="SignatureAlgorithm.PS256"/>, <see cref="SignatureAlgorithm.RS256"/></description>
/// </item>
/// <item>
/// <term><see cref="SHA384"/></term>
Expand Down Expand Up @@ -1130,7 +1130,7 @@ public virtual SignResult SignData(SignatureAlgorithm algorithm, byte[] data, Ca
/// <list type="bullet">
/// <item>
/// <term><see cref="SHA256"/></term>
/// <description><see cref="SignatureAlgorithm.EdDSA"/>, <see cref="SignatureAlgorithm.ES256"/>, <see cref="SignatureAlgorithm.ES256K"/>, <see cref="SignatureAlgorithm.PS256"/>, <see cref="SignatureAlgorithm.RS256"/></description>
/// <description><see cref="SignatureAlgorithm.EdDsa"/>, <see cref="SignatureAlgorithm.ES256"/>, <see cref="SignatureAlgorithm.ES256K"/>, <see cref="SignatureAlgorithm.PS256"/>, <see cref="SignatureAlgorithm.RS256"/></description>
/// </item>
/// <item>
/// <term><see cref="SHA384"/></term>
Expand Down Expand Up @@ -1210,7 +1210,7 @@ public virtual async Task<SignResult> SignDataAsync(SignatureAlgorithm algorithm
/// <list type="bullet">
/// <item>
/// <term><see cref="SHA256"/></term>
/// <description><see cref="SignatureAlgorithm.EdDSA"/>, <see cref="SignatureAlgorithm.ES256"/>, <see cref="SignatureAlgorithm.ES256K"/>, <see cref="SignatureAlgorithm.PS256"/>, <see cref="SignatureAlgorithm.RS256"/></description>
/// <description><see cref="SignatureAlgorithm.EdDsa"/>, <see cref="SignatureAlgorithm.ES256"/>, <see cref="SignatureAlgorithm.ES256K"/>, <see cref="SignatureAlgorithm.PS256"/>, <see cref="SignatureAlgorithm.RS256"/></description>
/// </item>
/// <item>
/// <term><see cref="SHA384"/></term>
Expand Down Expand Up @@ -1289,7 +1289,7 @@ public virtual SignResult SignData(SignatureAlgorithm algorithm, Stream data, Ca
/// <list type="bullet">
/// <item>
/// <term><see cref="SHA256"/></term>
/// <description><see cref="SignatureAlgorithm.EdDSA"/>, <see cref="SignatureAlgorithm.ES256"/>, <see cref="SignatureAlgorithm.ES256K"/>, <see cref="SignatureAlgorithm.PS256"/>, <see cref="SignatureAlgorithm.RS256"/></description>
/// <description><see cref="SignatureAlgorithm.EdDsa"/>, <see cref="SignatureAlgorithm.ES256"/>, <see cref="SignatureAlgorithm.ES256K"/>, <see cref="SignatureAlgorithm.PS256"/>, <see cref="SignatureAlgorithm.RS256"/></description>
/// </item>
/// <item>
/// <term><see cref="SHA384"/></term>
Expand Down Expand Up @@ -1369,7 +1369,7 @@ public virtual async Task<VerifyResult> VerifyDataAsync(SignatureAlgorithm algor
/// <list type="bullet">
/// <item>
/// <term><see cref="SHA256"/></term>
/// <description><see cref="SignatureAlgorithm.EdDSA"/>, <see cref="SignatureAlgorithm.ES256"/>, <see cref="SignatureAlgorithm.ES256K"/>, <see cref="SignatureAlgorithm.PS256"/>, <see cref="SignatureAlgorithm.RS256"/></description>
/// <description><see cref="SignatureAlgorithm.EdDsa"/>, <see cref="SignatureAlgorithm.ES256"/>, <see cref="SignatureAlgorithm.ES256K"/>, <see cref="SignatureAlgorithm.PS256"/>, <see cref="SignatureAlgorithm.RS256"/></description>
/// </item>
/// <item>
/// <term><see cref="SHA384"/></term>
Expand Down Expand Up @@ -1448,7 +1448,7 @@ public virtual VerifyResult VerifyData(SignatureAlgorithm algorithm, byte[] data
/// <list type="bullet">
/// <item>
/// <term><see cref="SHA256"/></term>
/// <description><see cref="SignatureAlgorithm.EdDSA"/>, <see cref="SignatureAlgorithm.ES256"/>, <see cref="SignatureAlgorithm.ES256K"/>, <see cref="SignatureAlgorithm.PS256"/>, <see cref="SignatureAlgorithm.RS256"/></description>
/// <description><see cref="SignatureAlgorithm.EdDsa"/>, <see cref="SignatureAlgorithm.ES256"/>, <see cref="SignatureAlgorithm.ES256K"/>, <see cref="SignatureAlgorithm.PS256"/>, <see cref="SignatureAlgorithm.RS256"/></description>
/// </item>
/// <item>
/// <term><see cref="SHA384"/></term>
Expand Down Expand Up @@ -1528,7 +1528,7 @@ public virtual async Task<VerifyResult> VerifyDataAsync(SignatureAlgorithm algor
/// <list type="bullet">
/// <item>
/// <term><see cref="SHA256"/></term>
/// <description><see cref="SignatureAlgorithm.EdDSA"/>, <see cref="SignatureAlgorithm.ES256"/>, <see cref="SignatureAlgorithm.ES256K"/>, <see cref="SignatureAlgorithm.PS256"/>, <see cref="SignatureAlgorithm.RS256"/></description>
/// <description><see cref="SignatureAlgorithm.EdDsa"/>, <see cref="SignatureAlgorithm.ES256"/>, <see cref="SignatureAlgorithm.ES256K"/>, <see cref="SignatureAlgorithm.PS256"/>, <see cref="SignatureAlgorithm.RS256"/></description>
/// </item>
/// <item>
/// <term><see cref="SHA384"/></term>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Azure.Security.KeyVault.Keys.Cryptography
internal const string ES384Value = "ES384";
internal const string ES512Value = "ES512";
internal const string ES256KValue = "ES256K";
internal const string EdDSAValue = "EdDSA";
internal const string EdDsaValue = "EdDSA";

private readonly string _value;

Expand Down Expand Up @@ -88,7 +88,7 @@ public SignatureAlgorithm(string value)
/// <summary>
/// Gets an ECDSA with a secp256k1 curve <see cref="SignatureAlgorithm"/> as described in <see href="https://tools.ietf.org/html/rfc8032"/>.
/// </summary>
public static SignatureAlgorithm EdDSA { get; } = new SignatureAlgorithm(EdDSAValue);
public static SignatureAlgorithm EdDsa { get; } = new SignatureAlgorithm(EdDsaValue);

/// <summary>
/// Determines if two <see cref="SignatureAlgorithm"/> values are the same.
Expand Down Expand Up @@ -134,7 +134,7 @@ internal HashAlgorithm GetHashAlgorithm()
case PS256Value:
case ES256Value:
case ES256KValue:
case EdDSAValue:
case EdDsaValue:
return SHA256.Create();

case RS384Value:
Expand All @@ -160,7 +160,7 @@ internal HashAlgorithmName GetHashAlgorithmName()
case PS256Value:
case ES256Value:
case ES256KValue:
case EdDSAValue:
case EdDsaValue:
return HashAlgorithmName.SHA256;

case RS384Value:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public async Task WrapUnwrapRoundTrip([EnumValues(Exclude = new[] { nameof(KeyWr
}

[RecordedTest]
public async Task SignVerifyDataRoundTrip([EnumValues(Exclude = new[] {SignatureAlgorithm.EdDSAValue})] SignatureAlgorithm algorithm)
public async Task SignVerifyDataRoundTrip([EnumValues(Exclude = new[] { nameof(SignatureAlgorithm.EdDsa) })] SignatureAlgorithm algorithm)
{
KeyVaultKey key = await CreateTestKey(algorithm);
RegisterForCleanup(key.Name);
Expand Down Expand Up @@ -125,7 +125,7 @@ public async Task SignVerifyDataRoundTrip([EnumValues(Exclude = new[] {Signature
}

[RecordedTest]
public async Task SignVerifyDataStreamRoundTrip([EnumValues(Exclude = new[] { SignatureAlgorithm.EdDSAValue })] SignatureAlgorithm algorithm)
public async Task SignVerifyDataStreamRoundTrip([EnumValues(Exclude = new[] { nameof(SignatureAlgorithm.EdDsa) })] SignatureAlgorithm algorithm)
{
KeyVaultKey key = await CreateTestKey(algorithm);
RegisterForCleanup(key.Name);
Expand Down Expand Up @@ -175,7 +175,7 @@ public async Task SignVerifyDataStreamRoundTrip([EnumValues(Exclude = new[] { Si
// We do not test using ES256K below since macOS doesn't support it; various ideas to work around that adversely affect runtime code too much.

[RecordedTest]
public async Task LocalSignVerifyRoundTrip([EnumValues(Exclude = new[] { nameof(SignatureAlgorithm.ES256K), nameof(SignatureAlgorithm.EdDSA) })] SignatureAlgorithm algorithm)
public async Task LocalSignVerifyRoundTrip([EnumValues(Exclude = new[] { nameof(SignatureAlgorithm.ES256K), nameof(SignatureAlgorithm.EdDsa) })] SignatureAlgorithm algorithm)
{
#if NET461
if (algorithm.GetEcKeyCurveName() != default)
Expand Down Expand Up @@ -252,7 +252,7 @@ public async Task LocalSignVerifyRoundTripOnFramework([EnumValues(nameof(Signatu
}

[RecordedTest]
public async Task SignLocalVerifyRoundTrip([EnumValues(Exclude = new[] { nameof(SignatureAlgorithm.ES256K), nameof(SignatureAlgorithm.EdDSA) })] SignatureAlgorithm algorithm)
public async Task SignLocalVerifyRoundTrip([EnumValues(Exclude = new[] { nameof(SignatureAlgorithm.ES256K), nameof(SignatureAlgorithm.EdDsa) })] SignatureAlgorithm algorithm)
{
#if NET461
if (algorithm.GetEcKeyCurveName() != default)
Expand Down Expand Up @@ -482,7 +482,7 @@ protected async Task<KeyVaultKey> CreateTestKey(SignatureAlgorithm algorithm)
return await Client.CreateEcKeyAsync(new CreateEcKeyOptions(keyName, false) { CurveName = KeyCurveName.P384 });
case SignatureAlgorithm.ES512Value:
return await Client.CreateEcKeyAsync(new CreateEcKeyOptions(keyName, false) { CurveName = KeyCurveName.P521 });
case SignatureAlgorithm.EdDSAValue:
case SignatureAlgorithm.EdDsaValue:
return await Client.CreateOkpKeyAsync(new CreateOkpKeyOptions(keyName, false) { CurveName = KeyCurveName.Ed25519 });
default:
throw new ArgumentException("Invalid Algorithm", nameof(algorithm));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static JsonWebKey CreateKey(SignatureAlgorithm algorithm, bool includePri
}
#endif

case SignatureAlgorithm.EdDSAValue:
case SignatureAlgorithm.EdDsaValue:
// TODO: Support OKP keys and Ed25519 curves: https://github.com/Azure/azure-sdk-for-net/issues/32232
throw new IgnoreException("Creating client-side OKP keys is not supported.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public async Task AesKwWrapUnwrapRoundTrip([EnumValues(
[RecordedTest]
public async Task EdDSASignVerifyRoundTrip()
{
SignatureAlgorithm algorithm = SignatureAlgorithm.EdDSA;
SignatureAlgorithm algorithm = SignatureAlgorithm.EdDsa;

KeyVaultKey key = await CreateTestKey(algorithm);
RegisterForCleanup(key.Name);
Expand Down

0 comments on commit 00c06ee

Please sign in to comment.