Skip to content

Commit

Permalink
Support v3 revocation signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgdotcom committed Dec 10, 2023
1 parent cdb4ec3 commit 0f9f714
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions openpgp/packet/public_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,16 @@ func (pk *PublicKey) VerifyRevocationSignature(sig *Signature) (err error) {
return pk.VerifySignature(h, sig)
}

// VerifyRevocationSignatureV3 returns nil iff sig is a valid signature, made by this
// public key.
func (pk *PublicKey) VerifyRevocationSignatureV3(sig *SignatureV3) (err error) {
h, err := keyRevocationHash(pk, sig.Hash)
if err != nil {
return err
}
return pk.VerifySignatureV3(h, sig)
}

// VerifySubkeyRevocationSignature returns nil iff sig is a valid subkey revocation signature,
// made by this public key, of signed.
func (pk *PublicKey) VerifySubkeyRevocationSignature(sig *Signature, signed *PublicKey) (err error) {
Expand Down
10 changes: 10 additions & 0 deletions openpgp/packet/public_key_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,16 @@ func (pk *PublicKeyV3) VerifyKeySignatureV3(signed *PublicKeyV3, sig *SignatureV
return pk.VerifySignatureV3(h, sig)
}

// VerifyRevocationSignatureV3 returns nil iff sig is a valid signature, made by this
// public key.
func (pk *PublicKeyV3) VerifyRevocationSignatureV3(sig *SignatureV3) (err error) {
h, err := keyRevocationHash(pk, sig.Hash)
if err != nil {
return err
}
return pk.VerifySignatureV3(h, sig)
}

// userIdSignatureV3Hash returns a Hash of the message that needs to be signed
// to assert that pk is a valid key for id.
func userIdSignatureV3Hash(id string, pk signingKey, hfn crypto.Hash) (h hash.Hash, err error) {
Expand Down

0 comments on commit 0f9f714

Please sign in to comment.