-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[API Proposal]: Additional Hash Algorithms for X509SubjectKeyIdentifierHashAlgorithm #97158
Comments
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones Issue DetailsBackground and motivationIn PKIX / X.509, the SubjectKeyIdentifier and AuthorityKeyIdentifier are opaque identifiers, however traditionally they have been derived from a SHA-1 over the subjectPublicKey. SHA-1 has largely been discouraged for a long time. Even in places that are not strictly security, such as SKI and AKI, the use of SHA-1 comes with scrutiny from a compliance perspective. Today, we only support a few flavors of SHA-1 with API Proposalnamespace System.Security.Cryptography.X509Certificates;
public enum X509SubjectKeyIdentifierHashAlgorithm {
Sha1 = 0,
ShortSha1 = 1,
CapiSha1 = 2,
+ TruncatedSha256 = 3, // leftmost 160-bits of the SHA-256 hash
+ TruncatedSha384 = 4, // leftmost 160-bits of the SHA-384 hash
+ TruncatedSha512 = 5, // leftmost 160-bits of the SHA-512 hash
+ Sha256 = 6,
+ Sha384 = 7,
+ Sha512 = 8,
} API UsageX509SubjectKeyIdentifierExtension mySki = new(
myPublicKey,
X509SubjectKeyIdentifierHashAlgorithm.TruncatedSha256,
critical: false); Alternative DesignsNo response RisksNo response
|
"Why does the new proposal have 'Truncated' entries when the existing one has 'Short'?" RFC 5280, 4.2.1.2 defines the second method of computation as the 64-bit value 0b0100 concat the 60 rightmost bits of the SHA-1; but RFC 7039, 2 defines the new ones as the leftmost 160 bits of the bigger algorithms. It's a different kind of short, so a different word. "Oh, OK, fair enough." |
And the non-truncated ones moved from just the encoded key to the full SPKI? Ugh. Then maybe I do want to re-assert my "withheld" Short vs Truncated and say that the API doesn't need to really show these differences, they can be covered in docs. public enum X509SubjectKeyIdentifierHashAlgorithm {
Sha1 = 0, // SHA-1 over the subjectPublicKey
ShortSha1 = 1, // 0b0100 concat rightmost 60 bits of the SHA-1 over subjectPublicKey
CapiSha1 = 2, // Some CAPI thing
+ ShortSha256 = 3, // leftmost 160-bits of the SHA-256 hash over subjectPublicKey
+ ShortSha384 = 4, // leftmost 160-bits of the SHA-384 hash over subjectPublicKey
+ ShortSha512 = 5, // leftmost 160-bits of the SHA-512 hash over subjectPublicKey
+ Sha256 = 6, // SHA-256 hash over the full SubjectPublicKeyInfo
+ Sha384 = 7, // SHA-384 hash over the full SubjectPublicKeyInfo
+ Sha512 = 8, // SHA-512 hash over the full SubjectPublicKeyInfo
} That looks a bit cleaner to me. |
Yeah, but I did want to convey they are different, hence It seems equally "weird" to me that |
Well, we can fall back on good old "blame the RFC", and call it |
Well, there are two SHA-256s. One truncated over subjectPublicKey and another full over SPKI. So
Uh...
Yes that. |
Okay, I optimistically took another guess at naming. |
Don't love it, don't hate it... but we can see what the group thinks. |
public enum X509SubjectKeyIdentifierHashAlgorithm {
Sha1 = 0, // SHA-1 over the subjectPublicKey
ShortSha1 = 1, // 0b0100 concat rightmost 60 bits of the SHA-1 over subjectPublicKey
CapiSha1 = 2, // Some CAPI thing
+ Sha256 = 3, // SHA-256 hash over the full SubjectPublicKeyInfo
+ Sha384 = 4, // SHA-384 hash over the full SubjectPublicKeyInfo
+ Sha512 = 5, // SHA-512 hash over the full SubjectPublicKeyInfo
+ ShortSha256 = 6, // leftmost 160-bits of the SHA-256 hash over subjectPublicKey
+ ShortSha384 = 7, // leftmost 160-bits of the SHA-384 hash over subjectPublicKey
+ ShortSha512 = 8, // leftmost 160-bits of the SHA-512 hash over subjectPublicKey
} |
Background and motivation
In PKIX / X.509, the SubjectKeyIdentifier and AuthorityKeyIdentifier are opaque identifiers, however traditionally they have been derived from a SHA-1 over the subjectPublicKey.
SHA-1 has largely been discouraged for a long time. Even in places that are not strictly security, such as SKI and AKI, the use of SHA-1 comes with scrutiny from a compliance perspective, and requires an ongoing "exception" process.
Today, we only support a few flavors of SHA-1 with
X509SubjectKeyIdentifierHashAlgorithm
. This proposal is to add other hash algorithms as defined by RFC 7093.API Proposal
API Usage
Alternative Designs
No response
Risks
No response
The text was updated successfully, but these errors were encountered: