Skip to content

[API Proposal]: Additional Hash Algorithms for X509SubjectKeyIdentifierHashAlgorithm #97158

@vcsjones

Description

@vcsjones

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

namespace System.Security.Cryptography.X509Certificates;

public enum X509SubjectKeyIdentifierHashAlgorithm {
    Sha1 = 0,
    ShortSha1 = 1,
    CapiSha1 = 2,
+   Rfc7093TruncatedSha256 = 3, //  leftmost 160-bits of the SHA-256 hash over subjectPublicKey
+   Rfc7093TruncatedSha384 = 4, //  leftmost 160-bits of the SHA-384 hash over subjectPublicKey
+   Rfc7093TruncatedSha512 = 5, //  leftmost 160-bits of the SHA-512 hash over subjectPublicKey
+   Rfc7093Sha256 = 6, // Full SHA-256 hash over SubjectPublicKeyInfo
+   Rfc7093Sha384 = 7, // Full SHA-384 hash over SubjectPublicKeyInfo
+   Rfc7093Sha512 = 8, // Full SHA-512 hash over SubjectPublicKeyInfo
}

API Usage

X509SubjectKeyIdentifierExtension mySki = new(
    myPublicKey,
    X509SubjectKeyIdentifierHashAlgorithm. Rfc7093TruncatedSha256,
    critical: false);

Alternative Designs

No response

Risks

No response

Metadata

Metadata

Assignees

Labels

api-approvedAPI was approved in API review, it can be implementedarea-System.Securityin-prThere is an active PR which will close this issue when it is merged

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions