Skip to content

Commit 5e4628d

Browse files
committed
misc: run dotnet format
1 parent b2eb647 commit 5e4628d

File tree

7 files changed

+50
-23
lines changed

7 files changed

+50
-23
lines changed

Yubico.Core/src/Yubico/Core/Devices/Hid/WindowsHidDevice.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ private void ResolveIdsFromInstancePath(string instancePath)
7676
// 012345678901234567890123456789
7777
// ^--- ^---
7878

79-
#pragma warning disable CA1862
79+
#pragma warning disable CA1862
8080
if (instancePath.ToUpperInvariant().Contains("VID") && instancePath.ToUpperInvariant().Contains("HID"))
81-
#pragma warning restore CA1862
81+
#pragma warning restore CA1862
8282
{
8383
// If this fails, vendorId will be 0.
8484
_ = TryGetHexShort(instancePath, 12, 4, out ushort vendorId);

Yubico.Core/src/Yubico/PlatformInterop/Desktop/SCard/SCardReaderStates.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ namespace Yubico.PlatformInterop
2828
[SuppressMessage("Style", "IDE0044:Add readonly modifier")]
2929
internal struct SCARD_READER_STATE
3030
{
31-
#pragma warning disable IDE0032
31+
#pragma warning disable IDE0032
3232
[MarshalAs(UnmanagedType.LPStr)]
3333
private string _readerName;
34-
#pragma warning restore IDE0032
34+
#pragma warning restore IDE0032
3535
private IntPtr _userData;
3636
private uint _currentState;
3737
private uint _eventState;

Yubico.YubiKey/src/Yubico/YubiKey/Oath/Credential.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,11 +589,11 @@ public static Credential ParseUri(Uri uri)
589589
/// </returns>
590590
private static (string? issuer, string account) ParseUriPath(string path, string? defaultIssuer)
591591
{
592-
#pragma warning disable CA1865
592+
#pragma warning disable CA1865
593593
string tempPath = path.StartsWith("/", ignoreCase: true, CultureInfo.InvariantCulture)
594594
? path[1..]
595595
: path;
596-
#pragma warning restore CA1865
596+
#pragma warning restore CA1865
597597

598598
if (tempPath.Length > MaximumUrlLength)
599599
{

Yubico.YubiKey/tests/integration/Yubico/YubiKey/Piv/MoveDeleteKeyTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void MoveKey_WithImportedKey(PivAlgorithm expectedAlgorithm)
7676
DeleteKeys(pivSession, sourceSlot, destinationSlot);
7777

7878
var importedPrivateKey = SampleKeyPairs.GetPivPrivateKey(expectedAlgorithm);
79-
var importedPublicKey = SampleKeyPairs.GetPivPublicKey(expectedAlgorithm);
79+
var importedPublicKey = SampleKeyPairs.GetPivPublicKey(expectedAlgorithm);
8080

8181
pivSession.ImportPrivateKey(sourceSlot, importedPrivateKey);
8282

Yubico.YubiKey/tests/unit/Yubico/YubiKey/TestUtilities/TestKeysTests.cs

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright 2024 Yubico AB
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License").
4+
// You may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
using System;
216
using System.IO;
317
using Xunit;
@@ -10,7 +24,7 @@ public class TestKeysTests
1024
public void TestKey_LoadRSA_CanReadPublicKey()
1125
{
1226
var key = TestKeys.GetPublicKey("rsa4096");
13-
27+
1428
var rsaKey = key.AsRSA();
1529
Assert.NotNull(rsaKey);
1630
Assert.Equal(4096, rsaKey.KeySize);
@@ -20,7 +34,7 @@ public void TestKey_LoadRSA_CanReadPublicKey()
2034
public void TestKey_LoadRSA_CanReadPrivateKey()
2135
{
2236
var key = TestKeys.GetPrivateKey("rsa4096");
23-
37+
2438
var rsaKey = key.AsRSA();
2539
Assert.NotNull(rsaKey);
2640
Assert.Equal(4096, rsaKey.KeySize);
@@ -30,7 +44,7 @@ public void TestKey_LoadRSA_CanReadPrivateKey()
3044
public void TestKey_LoadECDsa_CanReadPublicKey()
3145
{
3246
var key = TestKeys.GetPublicKey("p384");
33-
47+
3448
var ecKey = key.AsECDsa();
3549
Assert.NotNull(ecKey);
3650
}
@@ -39,23 +53,23 @@ public void TestKey_LoadECDsa_CanReadPublicKey()
3953
public void TestKey_LoadECDsa_ThrowsOnRSAKey()
4054
{
4155
var key = TestKeys.GetPublicKey("rsa4096");
42-
56+
4357
Assert.Throws<InvalidOperationException>(() => key.AsECDsa());
4458
}
4559

4660
[Fact]
4761
public void TestKey_LoadRSA_ThrowsOnECKey()
4862
{
4963
var key = TestKeys.GetPublicKey("p384");
50-
64+
5165
Assert.Throws<InvalidOperationException>(() => key.AsRSA());
5266
}
5367

5468
[Fact]
5569
public void TestKey_AsBase64_StripsHeaders()
5670
{
5771
var key = TestKeys.GetPublicKey("rsa4096");
58-
72+
5973
string base64 = key.AsBase64();
6074
Assert.DoesNotContain("-----BEGIN", base64);
6175
Assert.DoesNotContain("-----END", base64);
@@ -66,7 +80,7 @@ public void TestKey_AsBase64_StripsHeaders()
6680
public void TestKey_AsPemBase64_PreservesFormat()
6781
{
6882
var key = TestKeys.GetPublicKey("rsa4096");
69-
83+
7084
string pem = key.AsPemString();
7185
Assert.Contains("-----BEGIN PUBLIC KEY-----", pem);
7286
Assert.Contains("-----END PUBLIC KEY-----", pem);
@@ -76,7 +90,7 @@ public void TestKey_AsPemBase64_PreservesFormat()
7690
public void TestCertificate_Load_CanReadCertificate()
7791
{
7892
var cert = TestKeys.GetCertificate("rsa4096");
79-
93+
8094
var x509 = cert.AsX509Certificate2();
8195
Assert.NotNull(x509);
8296
}
@@ -86,7 +100,7 @@ public void TestCertificate_Load_CanReadAttestationCertificate()
86100
{
87101
var cert = TestKeys.GetCertificate("rsa4096", true);
88102
Assert.True(cert.IsAttestation);
89-
103+
90104
var x509 = cert.AsX509Certificate2();
91105
Assert.NotNull(x509);
92106
}

Yubico.YubiKey/tests/utilities/Yubico/YubiKey/TestUtilities/SampleKeyPairs.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
using System.Security.Cryptography.X509Certificates;
1717
using Yubico.YubiKey.Piv;
1818

19-
namespace Yubico.YubiKey.TestUtilities
19+
namespace Yubico.YubiKey.TestUtilities
2020
{
2121
public static class SampleKeyPairs
2222
{
2323
// Get a private key with its matching certificate
2424
public static bool GetMatchingKeyAndCert(
25-
PivAlgorithm algorithm,
25+
PivAlgorithm algorithm,
2626
out X509Certificate2? cert,
2727
out PivPrivateKey? privateKey)
2828
{
@@ -42,15 +42,15 @@ public static bool GetMatchingKeyAndCert(
4242
public static bool GetKeysAndCertPem(
4343
PivAlgorithm algorithm,
4444
bool validAttest,
45-
out string? cert,
45+
out string? cert,
4646
out string? publicKey,
4747
out string? privateKey)
4848
{
4949
string curve = GetCurveFromAlgorithm(algorithm);
5050
if (string.IsNullOrEmpty(curve))
5151
{
5252
cert = null;
53-
privateKey = null;
53+
privateKey = null;
5454
publicKey = null;
5555
return false;
5656
}
@@ -71,7 +71,7 @@ public static PivPublicKey GetPivPublicKey(PivAlgorithm algorithm)
7171
return TestKeys.GetPublicKey(curve).AsPublicKey();
7272
}
7373

74-
public static PivPrivateKey GetPivPrivateKey(PivAlgorithm algorithm)
74+
public static PivPrivateKey GetPivPrivateKey(PivAlgorithm algorithm)
7575
{
7676
var curve = GetCurveFromAlgorithm(algorithm);
7777
return TestKeys.GetPrivateKey(curve).AsPrivateKey();
@@ -88,7 +88,7 @@ private static string GetCurveFromAlgorithm(PivAlgorithm algorithm)
8888
return algorithm switch
8989
{
9090
PivAlgorithm.Rsa1024 => "rsa1024",
91-
PivAlgorithm.Rsa2048 => "rsa2048",
91+
PivAlgorithm.Rsa2048 => "rsa2048",
9292
PivAlgorithm.Rsa3072 => "rsa3072",
9393
PivAlgorithm.Rsa4096 => "rsa4096",
9494
PivAlgorithm.EccP256 => "p256",

Yubico.YubiKey/tests/utilities/Yubico/YubiKey/TestUtilities/TestKeys.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1+
// Copyright 2024 Yubico AB
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License").
4+
// You may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
using System;
216
using System.IO;
317
using System.Security.Cryptography;
418
using System.Security.Cryptography.X509Certificates;
5-
using Yubico.YubiKey.Piv;
619

720
namespace Yubico.YubiKey.TestUtilities
821
{

0 commit comments

Comments
 (0)