Skip to content

Commit e738fa9

Browse files
committed
variable rename for clarity (scp)
1 parent 6dd671d commit e738fa9

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

Yubico.YubiKey/src/Yubico/YubiKey/Scp/Scp03KeyParameters.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ namespace Yubico.YubiKey.Scp
2121
/// </summary>
2222
public sealed class Scp03KeyParameters : ScpKeyParameters, IDisposable
2323
{
24-
private const int DefaultKvn = 0xFF;
25-
private const int DefaultKid = 0x01;
24+
private const int DefaultKeyKvn = 0xFF;
25+
private const int DefaultKvn = 0x01;
2626

2727
/// <summary>
2828
/// The static keys shared with the device when initiating the connection.
@@ -76,7 +76,7 @@ public Scp03KeyParameters(
7676
/// This property provides a convenient way to access default SCP03 key parameters,
7777
/// using the standard SCP03 key identifier (0x03) and default static keys with version number 0xFF.
7878
/// </remarks>
79-
public static Scp03KeyParameters DefaultKey => new Scp03KeyParameters(ScpKeyIds.Scp03, DefaultKvn, new StaticKeys());
79+
public static Scp03KeyParameters DefaultKey => new Scp03KeyParameters(ScpKeyIds.Scp03, DefaultKeyKvn, new StaticKeys());
8080

8181
/// <summary>
8282
/// Creates a new instance of <see cref="Scp03KeyParameters"/>, representing the parameters for
@@ -86,7 +86,7 @@ public Scp03KeyParameters(
8686
/// <param name="staticKeys">The static keys shared with the device.</param>
8787
/// <returns>An instance of <see cref="Scp03KeyParameters"/> with key ID 0x03 and version number 0x01.</returns>
8888
public static Scp03KeyParameters FromStaticKeys(StaticKeys staticKeys) =>
89-
new Scp03KeyParameters(ScpKeyIds.Scp03, DefaultKid, staticKeys);
89+
new Scp03KeyParameters(ScpKeyIds.Scp03, DefaultKvn, staticKeys);
9090

9191
/// <summary>
9292
/// This will clear all references and sensitive buffers

Yubico.YubiKey/src/Yubico/YubiKey/Scp/ScpKeyIds.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ public static class ScpKeyIds
3232
{
3333
/// <summary>
3434
/// Key ID '0x01' for static keys used for SCP03.
35+
/// <remarks>When storing SCP03 keysets, the SDK
36+
/// will store ke KID's 0x01, 0x02 and 0x03 for ENC, MAC, DEK on the YubiKey
37+
/// </remarks>
3538
/// </summary>
3639
public const byte Scp03 = 0x01;
3740

Yubico.YubiKey/src/Yubico/YubiKey/Scp03/StaticKeys.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ internal StaticKeys GetCopy() =>
190190
};
191191

192192
internal Scp03KeyParameters ConvertToScp03KeyParameters() =>
193-
new Scp03KeyParameters(ScpKeyIds.Scp03, 0xFF, ConvertFromLegacy());
193+
new Scp03KeyParameters(ScpKeyIds.Scp03, DefaultKvnValue, ConvertFromLegacy());
194194

195195
/// <summary>
196196
/// Determine if the contents of each key is the same for both objects.

Yubico.YubiKey/tests/integration/Yubico/YubiKey/Scp/Scp11Tests.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,14 +605,17 @@ private Memory<byte> GetSki(
605605
private static Scp03KeyParameters ImportScp03Key(
606606
SecurityDomainSession session)
607607
{
608-
var scp03Ref = new KeyReference(0x01, 0x01);
608+
byte scp03KeyId = 0x01;
609+
byte kvn = 0x01;
610+
611+
var scp03Ref = new KeyReference(scp03KeyId, kvn);
609612
var staticKeys = new StaticKeys(
610613
GetRandomBytes(16),
611614
GetRandomBytes(16),
612615
GetRandomBytes(16)
613616
);
614617

615-
session.PutKey(scp03Ref, staticKeys, 0);
618+
session.PutKey(scp03Ref, staticKeys);
616619

617620
return new Scp03KeyParameters(scp03Ref, staticKeys);
618621
}

0 commit comments

Comments
 (0)