Do not return error on empty name or email key generation

This commit is contained in:
Aron Wussler 2022-04-25 13:13:51 +02:00
parent b601b54c1f
commit f5803d148d
2 changed files with 3 additions and 6 deletions

View file

@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- `DecryptMIMEMessage` will return the decrypted content in the `OnBody` callback, even when there's a signature verification error. That lets the caller decide whether they want to use the content with a warning or hard fail on signature errors.
- Key generation functions no longer return an error if either the name or email is empty
## [2.4.6] 2022-03-25

View file

@ -438,12 +438,8 @@ func generateKey(
bits int,
prime1, prime2, prime3, prime4 []byte,
) (*Key, error) {
if len(email) == 0 {
return nil, errors.New("gopenpgp: invalid email format")
}
if len(name) == 0 {
return nil, errors.New("gopenpgp: invalid name format")
if len(email) == 0 && len(name) == 0 {
return nil, errors.New("gopenpgp: neither name nor email set.")
}
comments := ""