Skip to content

Commit fe20047

Browse files
committed
tlsconfig: deprecate support for encrypted TLS private keys
> Legacy PEM encryption as specified in RFC 1423 is insecure by design. Since > it does not authenticate the ciphertext, it is vulnerable to padding oracle > attacks that can let an attacker recover the plaintext From https://go-review.googlesource.com/c/go/+/264159 > It's unfortunate that we don't implement PKCS#8 encryption so we can't > recommend an alternative but PEM encryption is so broken that it's worth > deprecating outright. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 85709ff commit fe20047

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

tlsconfig/config.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ type Options struct {
3636
ExclusiveRootPools bool
3737
MinVersion uint16
3838
// If Passphrase is set, it will be used to decrypt a TLS private key
39-
// if the key is encrypted
39+
// if the key is encrypted.
40+
//
41+
// Deprecated: Use of encrypted TLS private keys has been deprecated, and
42+
// will be removed in a future release. Golang has deprecated support for
43+
// legacy PEM encryption (as specified in RFC 1423), as it is insecure by
44+
// design (see https://go-review.googlesource.com/c/go/+/264159).
4045
Passphrase string
4146
}
4247

@@ -132,7 +137,12 @@ func adjustMinVersion(options Options, config *tls.Config) error {
132137
}
133138

134139
// IsErrEncryptedKey returns true if the 'err' is an error of incorrect
135-
// password when tryin to decrypt a TLS private key
140+
// password when trying to decrypt a TLS private key.
141+
//
142+
// Deprecated: Use of encrypted TLS private keys has been deprecated, and
143+
// will be removed in a future release. Golang has deprecated support for
144+
// legacy PEM encryption (as specified in RFC 1423), as it is insecure by
145+
// design (see https://go-review.googlesource.com/c/go/+/264159).
136146
func IsErrEncryptedKey(err error) bool {
137147
return errors.Cause(err) == x509.IncorrectPasswordError
138148
}

0 commit comments

Comments
 (0)