Skip to content

Commit ccdf02d

Browse files
author
Luís Ferreira
committed
detect_private_key: add textual version of PKCS #8 encrypted private keys
As described by RFC7468 and RFC5958, keys that are encoded using the "ENCRYPTED PRIVATE KEY" label are described as private key information and therefore can contain secrets, even though encrypted. Signed-off-by: Luís Ferreira <contact@lsferreira.net>
1 parent cf059f0 commit ccdf02d

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

pre_commit_hooks/detect_private_key.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
b'PuTTY-User-Key-File-2',
1212
b'BEGIN SSH2 ENCRYPTED PRIVATE KEY',
1313
b'BEGIN PGP PRIVATE KEY BLOCK',
14+
b'BEGIN ENCRYPTED PRIVATE KEY',
1415
]
1516

1617

tests/detect_private_key_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
(b'-----BEGIN OPENSSH PRIVATE KEY-----', 1),
1111
(b'PuTTY-User-Key-File-2: ssh-rsa', 1),
1212
(b'---- BEGIN SSH2 ENCRYPTED PRIVATE KEY ----', 1),
13+
(b'-----BEGIN ENCRYPTED PRIVATE KEY-----', 1),
1314
(b'ssh-rsa DATA', 0),
1415
(b'ssh-dsa DATA', 0),
1516
# Some arbitrary binary data

0 commit comments

Comments
 (0)