-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Security Domain and SCP11a/b/c features #164
base: develop
Are you sure you want to change the base?
Conversation
cfa5db9
to
69d6525
Compare
feat(scp11): Generate EC Key feat(sd): Reset Security Domain misc: Changed static analysis mode misc: SampleCode projects won't build nuget packages
Store identifiers in dictionary Utilize current and next TLV values Improve method functionality Enhance code readability
update auth-decrypt.md update auth-sign.md updated RSA key sizes in user manual files updated RSA key info in API docs updated docs and minor adjustments and new tests
support OATH and SCP support OTP and SCP support YubiHSM and SCP
69d6525
to
7a5053b
Compare
added YubiHsm SCP 11b tests
7a5053b
to
ff36d90
Compare
throws exception on invalid KeyParameters add docs
f2d9555
to
b6b97ad
Compare
75a40ae
to
e122693
Compare
ChannelEncyrption: use Span<byte> instead of byte[] ChannelMac: use Span<byte> instead of byte[] StoreDataCommand: change order of fields
e122693
to
11b87d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will address these things
|
||
namespace Yubico.YubiKey.Scp.Commands | ||
{ | ||
/// <summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be rewritten to account for SCP11
|
||
namespace Yubico.YubiKey.Scp | ||
{ | ||
/// <summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a rewrite to account for SCP11
224b1e9
to
38141bc
Compare
38141bc
to
3b2753d
Compare
#pragma warning disable CA5358 // Allow the usage of cipher mode 'ECB' | ||
aesObj.Mode = CipherMode.ECB; | ||
aesObj.Mode = CipherMode.ECB; |
Check failure
Code scanning / CodeQL
Encryption using ECB High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 5 days ago
To fix the problem, we should replace the use of ECB mode with a more secure mode of operation, such as CBC (Cipher Block Chaining) or GCM (Galois/Counter Mode). These modes provide better security by introducing randomness and ensuring that identical plaintext blocks produce different ciphertext blocks.
The best way to fix the problem without changing existing functionality is to use CBC mode with a randomly generated initialization vector (IV). This will require modifying the code to generate a random IV and use it for encryption. The IV should be stored or transmitted along with the ciphertext to allow for decryption.
Changes needed:
- Replace
CipherMode.ECB
withCipherMode.CBC
. - Generate a random IV and set it in the AES object.
- Ensure the IV is stored or transmitted with the ciphertext.
-
Copy modified line R55 -
Copy modified lines R61-R62
@@ -54,3 +54,3 @@ | ||
#pragma warning disable CA5358 // Allow the usage of cipher mode 'ECB' | ||
aesObj.Mode = CipherMode.ECB; | ||
aesObj.Mode = CipherMode.CBC; | ||
#pragma warning restore CA5358 | ||
@@ -59,4 +59,5 @@ | ||
aesObj.Key = aesObjKey; | ||
aesObj.IV = new byte[BlockSizeBytes]; | ||
aesObj.Padding = PaddingMode.None; | ||
aesObj.GenerateIV(); | ||
byte[] iv = aesObj.IV; | ||
#pragma warning disable CA5401 // Justification: Allow the symmetric encryption to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CBC is required and allowed for our use case.
Test Results: Windows 2 files 2 suites 5s ⏱️ Results for commit 15e7efa. ♻️ This comment has been updated with latest results. |
Test Results: Ubuntu 2 files 2 suites 9s ⏱️ Results for commit 15e7efa. ♻️ This comment has been updated with latest results. |
Test Results: MacOS 2 files 2 suites 4s ⏱️ Results for commit 15e7efa. ♻️ This comment has been updated with latest results. |
Yubico.YubiKey/docs/users-manual/application-piv/apdu/auth-sign.md
Outdated
Show resolved
Hide resolved
added validation of hostchallenge length added documentation for the class refactor around external authenticate for clarity
in: ScpState and SessionKeys.cs
docs: revert auto format of .md files misc: fixed typo in SecurityDomainSession
YubiKeyDeviceExtensions.cs was not meant to be deleted yet
Scp03 enum is obsolete removed comments added SecurityDomain enum to ConnectionManager.cs
Scp03Tests: All tests select transport. Will fail test if Nfc and Fips are selected
Description
This PR implements comprehensive support for SCP11a/b/c secure channels and enhances Security Domain functionality. It also enables OATH, OTP, and YubiHsm applications to operate over SCP connections.
Key Changes
../Scp/
namespace for improved secure channel managementSecurityDomainSession
New Components
SecurityDomainSession
: Application that manages the Security DomainScp03KeyParameters
: SCP03 key configurationScp11KeyParameters
: SCP11 key configurationKeyReference
: Refers to keys on the Yubikey Security DomainScp03State
: SCP03 state managementScp11State
: SCP11 state managementDeprecation and misc changes
../Scp03/
namespace../Scp11/
namespaceMigration Notes
The new architecture favors using
SecurityDomainSession
for Security Domain operations rather than individual command classes. Update existing implementations accordingly.Type of change
How has this been tested?
Tested using a 5.7.2 key.
Needs to test more thoroughly on other keys.
Test configuration:
Checklist:
dotnet format
to format my codeFootnotes
See Yubikey models (Multi-protocol, Security Key, FIPS, Bio, YubiHSM, YubiHSM FIPS) ↩