Skip to content

Commit 9a71a5e

Browse files
authored
Merge pull request #181 from Yubico/merge/release/1.12.1
Release 1.12.1
2 parents ad2f18b + 18d6803 commit 9a71a5e

File tree

12 files changed

+162
-72
lines changed

12 files changed

+162
-72
lines changed

README.md

Lines changed: 85 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- Copyright 2021 Yubico AB
1+
<!-- Copyright 2024 Yubico AB
22
33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.
@@ -21,42 +21,101 @@ limitations under the License. -->
2121
2222
# .NET YubiKey SDK
2323

24-
This is a cross-platform, all encompassing SDK for the YubiKey aimed at large to mid-sized enterprise
25-
customers. This version is written against .NET Core, and will eventually include bindings to languages
26-
outside the direct .NET ecosystem.
24+
Enterprise-grade cross-platform SDK for YubiKey integration, built on .NET.
2725

28-
## SDK Support
29-
The SDK is targetting net47, netstandard2.0 and netstandard2.1. This means the SDK can be loaded in NET Framework, NET6 and upwards.
26+
## Table of Contents
27+
- [Quick Start](#quick-start)
28+
- [Documentation](#documentation)
29+
- [SDK Support](#sdk-support)
30+
- [SDK Packages](#sdk-packages)
31+
- [Project Structure](#project-structure)
32+
- [Contributing](#contributing)
33+
- [Security](#security)
34+
35+
## Quick Start
36+
37+
### Installation
38+
```bash
39+
dotnet add package Yubico.YubiKey
40+
```
41+
42+
### Basic Usage
43+
```csharp
44+
using Yubico.YubiKey;
45+
46+
// Chooses the first YubiKey found on the computer.
47+
IYubiKeyDevice? SampleChooseYubiKey()
48+
{
49+
IEnumerable<IYubiKeyDevice> list = YubiKeyDevice.FindAll();
50+
return list.First();
51+
}
52+
```
3053

3154
## Documentation
3255

33-
The public documentation for this project is located
34-
at [https://docs.yubico.com/yesdk/](https://docs.yubico.com/yesdk/).
35-
Here you can find both API reference and a user's manual that describes the concepts that this SDK exposes.
56+
📚 Official documentation: [docs.yubico.com/yesdk](https://docs.yubico.com/yesdk/)
57+
- User Manual
58+
- API Reference
59+
60+
## SDK Support
61+
62+
Supported Target Frameworks:
63+
- .NET Framework 4.7
64+
- .NET Standard 2.1
65+
- .NET 6 and above
3666

37-
## Project structure
67+
## SDK Packages
3868

39-
The root of this repository contains the various projects that make up the SDK. Inside each project
40-
folder, you will find:
69+
### Public Assemblies
4170

42-
- docs - Supplementary documentation content for the SDK's API documentation.
43-
- examples - Example code demonstrating various capabilities of the SDK.
44-
- src - All source code that makes up the project.
45-
- tests - Unit and integration tests for the project.
71+
#### Yubico.YubiKey
72+
Primary assembly containing all classes and types needed for YubiKey interaction.
73+
74+
#### Yubico.Core
75+
Platform abstraction layer (PAL) providing:
76+
- OS-specific functionality abstraction
77+
- Device enumeration
78+
- Utility classes for various encoding/decoding operations:
79+
- Base16
80+
- Base32
81+
- Tag-Length-Value (BER Encoded TLV)
82+
- ModHex
83+
84+
### Internal Assemblies
85+
86+
#### Yubico.DotNetPolyfills
87+
> ⚠️ **Not for public use**
88+
> Backports BCL features needed by the SDK.
89+
90+
#### Yubico.NativeShims
91+
> ⚠️ **Not for public use**
92+
> 🔧 **Unmanaged Library**
93+
> Provides stable ABI for P/Invoke operations in Yubico.Core.
94+
95+
## Project Structure
96+
97+
Repository organization:
98+
- 📁 `docs/` - API documentation and supplementary content
99+
- 📁 `examples/` - Sample code and demonstrations
100+
- 📁 `src/` - Source code for all projects
101+
- 📁 `tests/` - Unit and integration tests
46102

47103
## Contributing
48104

49-
Please read the [Contributor's Guide](./CONTRIBUTING.md) and [Getting started](./contributordocs/getting-started.md)
50-
pages before opening a pull request on this project.
105+
1. Read the [Contributor's Guide](./CONTRIBUTING.md)
106+
2. Review [Getting Started](./contributordocs/getting-started.md)
107+
3. Submit your Pull Request
108+
109+
### Building the Project
51110

52-
### Building
111+
Prerequisites:
112+
1. Install required tools (see [Getting Started](./contributordocs/getting-started.md))
113+
2. Load `Yubico.NET.SDK.sln` into your IDE.
114+
3. Build solution
53115

54-
Read the [Getting started](./contributordocs/getting-started.md) page to understand the prerequisites needed
55-
to build. Once those have been installed, you should be able to load the Yubico.NET.SDK.sln file and build.
116+
---
56117

57-
Note that it is also possible to build the DocFX output at the same time as building the libraries. However,
58-
that is not done by default.
118+
## Connect with us
59119

60-
If you want to build the DocFX output when you build the libraries using Visual Studio, open the Visual
61-
Studio solution file, and open `Build:Configuration Manager...`. In the resulting window, under
62-
`Active solution configuration:` is a drop-down menu. Select `ReleaseWithDocs`.
120+
📫 Need help? [Create an issue](https://github.com/Yubico/Yubico.NET.SDK/issues/new/choose)
121+
📖 Read our blog for the latest Yubico updates [here](https://www.yubico.com/blog/)

Yubico.Core/src/Yubico.Core.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ limitations under the License. -->
4141
Yubico.Core is a support library used by other .NET Yubico libraries. You should likely never need to consume this package directly, as it will be included with other libraries.
4242
</Description>
4343
<PackageIcon>yubico-circle-y-mark.png</PackageIcon>
44+
<PackageReadmeFile>README.md</PackageReadmeFile>
4445
<PublishRepositoryUrl>true</PublishRepositoryUrl>
4546
<EmbedUntrackedSources>true</EmbedUntrackedSources>
4647
<IncludeSymbols>true</IncludeSymbols>
@@ -72,6 +73,7 @@ limitations under the License. -->
7273
</EmbeddedResource>
7374

7475
<None Include="..\..\LICENSE.txt" Pack="true" PackagePath="" />
76+
<None Include="..\..\README.md" Pack="true" PackagePath="" />
7577
<None Include="..\..\yubico-circle-y-mark.png" Pack="true" PackagePath="" />
7678
<None Include="..\..\Yubico.NET.SDK.snk">
7779
<Link>Yubico.NET.SDK.snk</Link>

Yubico.DotNetPolyfills/src/Yubico.DotNetPolyfills.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ limitations under the License. -->
3030

3131
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
3232
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
33+
<PackageReadmeFile>README.md</PackageReadmeFile>
3334
<PublishRepositoryUrl>true</PublishRepositoryUrl>
3435
<EmbedUntrackedSources>true</EmbedUntrackedSources>
3536
<IncludeSymbols>true</IncludeSymbols>
@@ -66,6 +67,7 @@ limitations under the License. -->
6667

6768
<ItemGroup>
6869
<None Include="..\..\LICENSE.txt" Pack="true" PackagePath="" />
70+
<None Include="..\..\README.md" Pack="true" PackagePath="" />
6971
</ItemGroup>
7072

7173
</Project>

Yubico.YubiKey/docs/users-manual/getting-started/whats-new.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ limitations under the License. -->
1717
Here you can find all of the updates and release notes for published versions of the SDK.
1818

1919
## 1.12.x Releases
20+
21+
### 1.12.1
22+
23+
Release date: December 19th, 2024
24+
25+
Bug Fixes: Now selects correct device initializing Fido2Session [(#179)](https://github.com/Yubico/Yubico.NET.SDK/pull/179)
26+
27+
2028
### 1.12.0
2129

2230
Release date: December 18th, 2024

Yubico.YubiKey/src/Yubico.YubiKey.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ limitations under the License. -->
4141
Yubico.YubiKey is the official .NET library for integrating with the YubiKey hardware authenticator. This library supports both macOS and Windows operating systems.
4242
</Description>
4343
<PackageIcon>yubico-circle-y-mark.png</PackageIcon>
44+
<PackageReadmeFile>README.md</PackageReadmeFile>
4445
<PublishRepositoryUrl>true</PublishRepositoryUrl>
4546
<EmbedUntrackedSources>true</EmbedUntrackedSources>
4647
<IncludeSymbols>true</IncludeSymbols>
@@ -100,8 +101,8 @@ limitations under the License. -->
100101
<LastGenOutput>ResponseStatusMessages.Designer.cs</LastGenOutput>
101102
<CustomToolNamespace>Yubico.YubiKey</CustomToolNamespace>
102103
</EmbeddedResource>
103-
104104
<None Include="..\..\LICENSE.txt" Pack="true" PackagePath="" />
105+
<None Include="..\..\README.md" Pack="true" PackagePath="" />
105106
<None Include="..\..\yubico-circle-y-mark.png" Pack="true" PackagePath="" />
106107
<None Include="..\..\Yubico.NET.SDK.snk">
107108
<Link>Yubico.NET.SDK.snk</Link>

Yubico.YubiKey/src/Yubico/YubiKey/ConnectionFactory.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,6 @@ public IScpYubiKeyConnection CreateScpConnection(YubiKeyApplication application,
112112
/// </remarks>
113113
public IYubiKeyConnection CreateConnection(YubiKeyApplication application)
114114
{
115-
if (_smartCardDevice != null)
116-
{
117-
_log.LogDebug("Connecting via the SmartCard interface.");
118-
119-
WaitForReclaimTimeout(Transport.SmartCard);
120-
return new SmartCardConnection(_smartCardDevice, application);
121-
}
122-
123115
if (_hidKeyboardDevice != null && application == YubiKeyApplication.Otp)
124116
{
125117
_log.LogDebug("Connecting via the Keyboard interface.");
@@ -128,13 +120,22 @@ public IYubiKeyConnection CreateConnection(YubiKeyApplication application)
128120
return new KeyboardConnection(_hidKeyboardDevice);
129121
}
130122

131-
if (_hidFidoDevice != null && (application == YubiKeyApplication.Fido2 || application == YubiKeyApplication.FidoU2f))
123+
bool isFidoApplication = application == YubiKeyApplication.Fido2 || application == YubiKeyApplication.FidoU2f;
124+
if (_hidFidoDevice != null && isFidoApplication)
132125
{
133126
_log.LogDebug("Connecting via the FIDO interface.");
134127

135128
WaitForReclaimTimeout(Transport.HidFido);
136129
return new FidoConnection(_hidFidoDevice);
137130
}
131+
132+
if (_smartCardDevice != null)
133+
{
134+
_log.LogDebug("Connecting via the SmartCard interface.");
135+
136+
WaitForReclaimTimeout(Transport.SmartCard);
137+
return new SmartCardConnection(_smartCardDevice, application);
138+
}
138139

139140
throw new InvalidOperationException("No suitable interface present. Unable to establish connection to YubiKey.");
140141
}

Yubico.YubiKey/src/Yubico/YubiKey/Oath/OathSession.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,9 @@ protected override void Dispose(bool disposing)
127127
{
128128
if (disposing)
129129
{
130-
return;
130+
KeyCollector = null;
131+
base.Dispose(disposing);
131132
}
132-
133-
KeyCollector = null;
134-
base.Dispose(disposing);
135133
}
136134
}
137135
}

Yubico.YubiKey/src/Yubico/YubiKey/Piv/Commands/InitializeAuthenticateManagementKeyCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public InitializeAuthenticateManagementKeyCommand()
321321
/// <remarks>
322322
/// Using this constructor is equivalent to
323323
/// <code language="csharp">
324-
/// new InitializeAuthenticateManagementKeyCommand(true, PivAlgorithm.AES192);
324+
/// new InitializeAuthenticateManagementKeyCommand(true, PivAlgorithm.algorithm);
325325
/// </code>
326326
/// </remarks>
327327
public InitializeAuthenticateManagementKeyCommand(PivAlgorithm algorithm)

Yubico.YubiKey/src/Yubico/YubiKey/Piv/Commands/SetManagementKeyCommand.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public sealed class SetManagementKeyCommand : IYubiKeyCommand<SetManagementKeyRe
137137
/// 5.4.2, only Triple-DES (<c>PivAlgorithm.TripleDes</c>) is supported.
138138
/// Beginning with 5.4.2, the Algorithm can be <c>Aes128</c>,
139139
/// <c>Aes192</c>, <c>Aes256</c>, or <c>TripleDes</c>. The default is
140-
/// <c>TripleDes</c>.
140+
/// <c>TripleDes</c> for keys with firmware 5.6.x and earlier and <c>Aes192</c> for YubiKeys with firmware 5.7.x and later.
141141
/// </summary>
142142
public PivAlgorithm Algorithm { get; set; }
143143

@@ -168,8 +168,7 @@ public SetManagementKeyCommand(ReadOnlyMemory<byte> newKey)
168168
/// <summary>
169169
/// Initializes a new instance of the <c>SetManagementKeyCommand</c> class.
170170
/// This command takes the new management key as input and will set the
171-
/// <c>TouchPolicy</c> and <c>Algorithm</c> properties to their
172-
/// respective defaults.
171+
/// <c>TouchPolicy</c> to the default state and the <c>Algorithm</c> to the algorithm provided.
173172
/// </summary>
174173
/// <remarks>
175174
/// This constructor is provided for those developers who want to use the
@@ -184,7 +183,7 @@ public SetManagementKeyCommand(ReadOnlyMemory<byte> newKey)
184183
/// <para>
185184
/// Valid algorithms are <c>PivAlgorithm.TripleDes</c>,
186185
/// <c>PivAlgorithm.Aes128</c>, <c>PivAlgorithm.Aes192</c>, and
187-
/// <c>PivAlgorithm.Aes256</c>. FIPS YubiKeys versions 5.7 and greater require <c>PivAlgorithm.Aes192</c>.
186+
/// <c>PivAlgorithm.Aes256</c>. FIPS YubiKeys versions 5.7 and greater require <c>PivAlgorithm.Aes192</c>. YubiKeys with firmware versions prior to 5.4.2 can only use <c>PivAlgorithm.TripleDes</c>.
188187
/// </para>
189188
/// <para>
190189
/// Note that you need to authenticate the current PIV management key before
@@ -219,7 +218,7 @@ public SetManagementKeyCommand(ReadOnlyMemory<byte> newKey, PivTouchPolicy touch
219218
/// <para>
220219
/// Valid algorithms are <c>PivAlgorithm.TripleDes</c>,
221220
/// <c>PivAlgorithm.Aes128</c>, <c>PivAlgorithm.Aes192</c>, and
222-
/// <c>PivAlgorithm.Aes256</c>. FIPS YubiKeys versions 5.7 and greater require <c>PivAlgorithm.Aes192</c>.
221+
/// <c>PivAlgorithm.Aes256</c>. FIPS YubiKeys versions 5.7 and greater require <c>PivAlgorithm.Aes192</c>. YubiKeys with firmware versions prior to 5.4.2 can only use <c>PivAlgorithm.TripleDes</c>.
223222
/// </para>
224223
/// <para>
225224
/// Note also that you need to authenticate the current PIV management

Yubico.YubiKey/src/Yubico/YubiKey/Piv/PivSession.Pinonly.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ private PivPinOnlyMode GetPinDerivedStatus(
513513

514514
/// <summary>
515515
/// Set the YubiKey's PIV application to be PIN-only with a PIN-derived
516-
/// and/or PIN-Protected management key (Firmware 5.7.x and later: AES-192. Firmware 5.6.x and earlier: TDES.). This sets the
516+
/// and/or PIN-Protected management key. The default management key algorithm will be used (AES-192 for YubiKeys with firmware 5.7.x and later, TDES for keys with firmware 5.6.x and earlier). This sets the
517517
/// YubiKey to either
518518
/// <code>
519519
/// PivPinOnlyMode.PinProtected
@@ -727,7 +727,7 @@ private PivPinOnlyMode GetPinDerivedStatus(
727727
/// </param>
728728
/// <exception cref="InvalidOperationException">
729729
/// There is no <c>KeyCollector</c> loaded, one of the keys provided was
730-
/// not of a valid key algorithm type (Firmware 5.7.x and later: AES-192. Firmware 5.6.x and earlier: TDES.), the data stored on the YubiKey is
730+
/// not of a valid key algorithm type, the data stored on the YubiKey is
731731
/// incompatible with PIN-only, or the YubiKey had some other error, such
732732
/// as unreliable connection.
733733
/// </exception>

0 commit comments

Comments
 (0)