Skip to content

Commit 48e919a

Browse files
committed
x509-cert: builder: disable DigitalSignature usage on Root and SubCA keys
Per RFC5280, DigitalSignature 'is asserted when the subject public key is used for verifying digital signatures, other than signatures on certificates (bit 5) and CRLs (bit 6)'. Using CA keys to sign random data would definitely be a bad practice and should be avoided. Thus remove the DigitalSignature keyUsage from these certificates. Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent 037fe48 commit 48e919a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

x509-cert/src/builder.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,8 @@ impl Profile {
164164
// Build Key Usage extension
165165
match self {
166166
Profile::Root | Profile::SubCA { .. } => {
167-
extensions.push(
168-
KeyUsage(
169-
KeyUsages::DigitalSignature | KeyUsages::KeyCertSign | KeyUsages::CRLSign,
170-
)
171-
.to_extension(tbs)?,
172-
);
167+
extensions
168+
.push(KeyUsage(KeyUsages::KeyCertSign | KeyUsages::CRLSign).to_extension(tbs)?);
173169
}
174170
Profile::Leaf {
175171
enable_key_agreement,

0 commit comments

Comments
 (0)