Skip to content

Commit

Permalink
Merge pull request #180 from ProtonMail/keygen-no-name
Browse files Browse the repository at this point in the history
Do not return error on empty name or email key generation
  • Loading branch information
wussler committed Apr 26, 2022
2 parents b601b54 + f5803d1 commit 74905cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 2 additions & 6 deletions crypto/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down

0 comments on commit 74905cd

Please sign in to comment.