Skip to content

Commit ade2bdf

Browse files
authored
Ceremony: use SHA256 to compute Subject Key IDs (#6632)
Use SHA256 instead of SHA1 to compute the Subject Key Identifier when producing new CA certs with the ceremony tool. This change is safe, as the issuance package ensures that we directly copy the Issuing CA's Subject Key Identifier value into the Authority Key Identifier field of the template certificate we pass to x509.CreateCertificate. Thus, all end-entity certs issued from a CA with a SHA256 Subject Key Identifier will have the correct value for their Authority Key Identifier, regardless of the method used to initially compute that value. This change adds 12 bytes to each self-signed Root CA certificate issued with this change, 24 bytes to each Subordinate CA certificate (whether a normal intermediate or a cross-signed root), and 12 bytes to each end-entity issued from those intermediates. Fixes #6630
1 parent d73125d commit ade2bdf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/ceremony/cert.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package notmain
22

33
import (
44
"crypto"
5-
"crypto/sha1"
5+
"crypto/sha256"
66
"crypto/x509"
77
"crypto/x509/pkix"
88
"encoding/asn1"
@@ -219,7 +219,7 @@ func generateSKID(pk []byte) ([]byte, error) {
219219
if _, err := asn1.Unmarshal(pk, &pkixPublicKey); err != nil {
220220
return nil, err
221221
}
222-
skid := sha1.Sum(pkixPublicKey.BitString.Bytes)
222+
skid := sha256.Sum256(pkixPublicKey.BitString.Bytes)
223223
return skid[:], nil
224224
}
225225

0 commit comments

Comments
 (0)