Skip to content

Commit 1efe4a0

Browse files
committed
Deprecate SerializeEncryptedKey[WithHiddenOption] and SerializeSymmetricKeyEncryptedReuseKey
These functions don't allow explicitly indicating whether AEAD is supported and are thus prone to misuse. The *AEAD versions should be used instead.
1 parent ee67844 commit 1efe4a0

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

openpgp/packet/encrypted_key.go

+2
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ func SerializeEncryptedKeyAEADwithHiddenOption(w io.Writer, pub *PublicKey, ciph
426426
// key, encrypted to pub.
427427
// PKESKv6 is used if config.AEAD() is not nil.
428428
// If config is nil, sensible defaults will be used.
429+
// Deprecated: Use SerializeEncryptedKeyAEAD instead.
429430
func SerializeEncryptedKey(w io.Writer, pub *PublicKey, cipherFunc CipherFunction, key []byte, config *Config) error {
430431
return SerializeEncryptedKeyAEAD(w, pub, cipherFunc, config.AEAD() != nil, key, config)
431432
}
@@ -434,6 +435,7 @@ func SerializeEncryptedKey(w io.Writer, pub *PublicKey, cipherFunc CipherFunctio
434435
// key, encrypted to pub. PKESKv6 is used if config.AEAD() is not nil.
435436
// The hidden option controls if the packet should be anonymous, i.e., omit key metadata.
436437
// If config is nil, sensible defaults will be used.
438+
// Deprecated: Use SerializeEncryptedKeyAEADwithHiddenOption instead.
437439
func SerializeEncryptedKeyWithHiddenOption(w io.Writer, pub *PublicKey, cipherFunc CipherFunction, key []byte, hidden bool, config *Config) error {
438440
return SerializeEncryptedKeyAEADwithHiddenOption(w, pub, cipherFunc, config.AEAD() != nil, key, hidden, config)
439441
}

openpgp/packet/symmetric_key_encrypted.go

+1
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ func SerializeSymmetricKeyEncrypted(w io.Writer, passphrase []byte, config *Conf
195195
// the given passphrase. The returned session key must be passed to
196196
// SerializeSymmetricallyEncrypted.
197197
// If config is nil, sensible defaults will be used.
198+
// Deprecated: Use SerializeSymmetricKeyEncryptedAEADReuseKey instead.
198199
func SerializeSymmetricKeyEncryptedReuseKey(w io.Writer, sessionKey []byte, passphrase []byte, config *Config) (err error) {
199200
return SerializeSymmetricKeyEncryptedAEADReuseKey(w, sessionKey, passphrase, config.AEAD() != nil, config)
200201
}

0 commit comments

Comments
 (0)