-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'merge/release/1.11' into develop
- Loading branch information
Showing
19 changed files
with
446 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,71 @@ | ||
# Copyright 2021 Yubico AB | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# # Copyright 2021 Yubico AB | ||
# # | ||
# # Licensed under the Apache License, Version 2.0 (the "License"); | ||
# # you may not use this file except in compliance with the License. | ||
# # You may obtain a copy of the License at | ||
# # | ||
# # http://www.apache.org/licenses/LICENSE-2.0 | ||
# # | ||
# # Unless required by applicable law or agreed to in writing, software | ||
# # distributed under the License is distributed on an "AS IS" BASIS, | ||
# # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# # See the License for the specific language governing permissions and | ||
# # limitations under the License. | ||
|
||
name: Check code formatting | ||
# name: Verify code style | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- 'main' | ||
- 'develop**' | ||
- 'release/**' | ||
paths: | ||
- '**.h' | ||
- '**.c' | ||
- '**.cs' | ||
- '**.csproj' | ||
- '**.sln' | ||
- '.github/workflows/check-code-formatting.yml' | ||
# on: | ||
# pull_request: | ||
# branches: | ||
# - 'main' | ||
# - 'develop**' | ||
# - 'release/**' | ||
# paths: | ||
# - '**.h' | ||
# - '**.c' | ||
# - '**.cs' | ||
# - '**.csproj' | ||
# - '**.sln' | ||
# - '.github/workflows/check-code-formatting.yml' | ||
|
||
jobs: | ||
verify-code-style: | ||
name: "Verify code style" | ||
runs-on: windows-latest | ||
# jobs: | ||
# verify-code-style: | ||
# name: "Verify code style" | ||
# runs-on: windows-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-dotnet@v4 | ||
with: | ||
global-json-file: global.json | ||
# - uses: actions/setup-dotnet@v4 | ||
# with: | ||
# global-json-file: global.json | ||
|
||
- name: Add local NuGet repository | ||
run: dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Yubico/index.json" | ||
# - name: Add local NuGet repository | ||
# run: dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Yubico/index.json" | ||
|
||
- name: Build Yubico.NET.SDK.sln | ||
run: dotnet build --nologo --verbosity normal Yubico.NET.SDK.sln | ||
# #- name: Build Yubico.NET.SDK.sln | ||
# # run: dotnet build --nologo --verbosity normal Yubico.NET.SDK.sln | ||
|
||
- name: "Add DOTNET to path explicitly to address bug where it cannot be found" | ||
shell: bash | ||
run: | | ||
DOTNET_PATH=$(which dotnet) | ||
if [ -z "$DOTNET_PATH" ]; then | ||
echo "dotnet not found via which, checking /usr/share/dotnet" | ||
# Finding all executables named dotnet and picking the first one | ||
DOTNET_PATH=$(find /usr/share/dotnet -type f -name "dotnet" -executable | head -n 1) | ||
fi | ||
# - name: "Add DOTNET to path explicitly to address bug where it cannot be found" | ||
# shell: bash | ||
# run: | | ||
# DOTNET_PATH=$(which dotnet) | ||
# if [ -z "$DOTNET_PATH" ]; then | ||
# echo "dotnet not found via which, checking /usr/share/dotnet" | ||
# # Finding all executables named dotnet and picking the first one | ||
# DOTNET_PATH=$(find /usr/share/dotnet -type f -name "dotnet" -executable | head -n 1) | ||
# fi | ||
|
||
if [ -z "$DOTNET_PATH" ]; then | ||
echo "dotnet executable not found." | ||
exit 1 | ||
else | ||
echo "Using dotnet at $DOTNET_PATH" | ||
DOTNET_DIR=$(dirname $(readlink -f $DOTNET_PATH)) | ||
echo "$DOTNET_DIR" >> $GITHUB_PATH | ||
echo "Added $DOTNET_DIR to GITHUB_PATH" | ||
fi | ||
# if [ -z "$DOTNET_PATH" ]; then | ||
# echo "dotnet executable not found." | ||
# exit 1 | ||
# else | ||
# echo "Using dotnet at $DOTNET_PATH" | ||
# DOTNET_DIR=$(dirname $(readlink -f $DOTNET_PATH)) | ||
# echo "$DOTNET_DIR" >> $GITHUB_PATH | ||
# echo "Added $DOTNET_DIR to GITHUB_PATH" | ||
# fi | ||
|
||
|
||
- name: Check for correct formatting | ||
run: dotnet format --verify-no-changes --no-restore -v d | ||
# - name: Check for correct formatting | ||
# run: dotnet format --verify-no-changes --no-restore -v d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
Yubico.YubiKey/docs/users-manual/sdk-programming-guide/pin-complexity-policy.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
uid: UsersManualPinComplexityPolicy | ||
--- | ||
|
||
<!-- Copyright 2024 Yubico AB | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. --> | ||
|
||
# PIN Complexity policy | ||
|
||
Since firmware 5.7, the YubiKey can enforce usage of non-trivial PINs in its applications, this feature has been named _PIN complexity policy_ and is derived from the current Revision 3 of SP 800-63 (specifically SP 800-63B-3) with additional consideration of Revision 4 of SP 800-63 (specifically SP 800-63B-4). | ||
|
||
If PIN complexity has been enforced, the YubiKey will refuse to set or change values of following, if they violate the policy: | ||
- PIV PIN and PUK | ||
- FIDO2 PIN | ||
|
||
That means that simple values such as `11111111`, `password` or `12345678` will be refused. The YubiKey can also be programmed during the pre-registration to refuse other specific values. More information can be found in our <a href="https://docs.yubico.com/hardware/yubikey/yk-tech-manual/5.7-firmware-specifics.html#pin-complexity">online documentation</a> for the firmware version 5.7 additions. | ||
|
||
The SDK has support for getting information about the feature and also a way how to let the client know that an error is related to PIN complexity. | ||
|
||
## Read current PIN complexity status | ||
The PIN complexity enforcement status is part of the `IYubiKeyDeviceInfo` through `bool IsPinComplexityEnabled` property. | ||
|
||
## Handle PIN complexity errors | ||
The SDK can be used to create a variety of applications. If those support setting or changing PINs, they should handle the situation when a YubiKey refuses the user value because it is violating the PIN complexity. | ||
|
||
The SDK communicates this by throwing specific Exceptions. | ||
|
||
### PIV Session | ||
In PIV session the exception thrown during PIN complexity violations is `SecurityException` with a specific message: `ExceptionMessages.PinComplexityViolation`. | ||
|
||
If the application uses `KeyCollectors`, the violation is reported through `KeyEntryData.IsViolatingPinComplexity`. | ||
|
||
The violations are reported for following operations: | ||
- `PivSession.ChangePin()` | ||
- `PivSession.ChangePuk()` | ||
- `PivSession.ResetPin()` | ||
|
||
### FIDO2 Session | ||
In the FIDO2 application, `Fido2Exception` with `Status` of `CtapStatus.PinPolicyViolation` is thrown after a PIN complexity was violated. For `KeyCollectors`, `KeyEntryData.IsViolatingPinComplexity` will be set to `true` for these situations. | ||
|
||
This applies to following `Fido2Session` operations: | ||
- `Fido2Session.SetPin()` | ||
- `Fido2Session.ChangePin()` | ||
|
||
## Example code | ||
You can find examples of code in the `PivSampleCode` and `Fido2SampleCode` examples as well in `PinComplexityTests` integration tests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.