Add mobile helpers to verify signature contexts.
This commit is contained in:
parent
753a3fedff
commit
2cf7a8caee
4 changed files with 35 additions and 2 deletions
|
|
@ -26,6 +26,20 @@ func DecryptExplicitVerify(
|
|||
return newExplicitVerifyMessage(message, err)
|
||||
}
|
||||
|
||||
// DecryptExplicitVerifyWithContext decrypts a PGP message given a private keyring
|
||||
// and a public keyring to verify the embedded signature. Returns the plain
|
||||
// data and an error on signature verification failure.
|
||||
// The caller can provide a context that will be used to verify the signature.
|
||||
func DecryptExplicitVerifyWithContext(
|
||||
pgpMessage *crypto.PGPMessage,
|
||||
privateKeyRing, publicKeyRing *crypto.KeyRing,
|
||||
verifyTime int64,
|
||||
verificationContext *crypto.VerificationContext,
|
||||
) (*ExplicitVerifyMessage, error) {
|
||||
message, err := privateKeyRing.DecryptWithContext(pgpMessage, publicKeyRing, verifyTime, verificationContext)
|
||||
return newExplicitVerifyMessage(message, err)
|
||||
}
|
||||
|
||||
// DecryptSessionKeyExplicitVerify decrypts a PGP data packet given a session key
|
||||
// and a public keyring to verify the embedded signature. Returns the plain data and
|
||||
// an error on signature verification failure.
|
||||
|
|
@ -39,6 +53,21 @@ func DecryptSessionKeyExplicitVerify(
|
|||
return newExplicitVerifyMessage(message, err)
|
||||
}
|
||||
|
||||
// DecryptSessionKeyExplicitVerifyWithContext decrypts a PGP data packet given a session key
|
||||
// and a public keyring to verify the embedded signature. Returns the plain data and
|
||||
// an error on signature verification failure.
|
||||
// The caller can provide a context that will be used to verify the signature.
|
||||
func DecryptSessionKeyExplicitVerifyWithContext(
|
||||
dataPacket []byte,
|
||||
sessionKey *crypto.SessionKey,
|
||||
publicKeyRing *crypto.KeyRing,
|
||||
verifyTime int64,
|
||||
verificationContext *crypto.VerificationContext,
|
||||
) (*ExplicitVerifyMessage, error) {
|
||||
message, err := sessionKey.DecryptAndVerifyWithContext(dataPacket, publicKeyRing, verifyTime, verificationContext)
|
||||
return newExplicitVerifyMessage(message, err)
|
||||
}
|
||||
|
||||
func newExplicitVerifyMessage(message *crypto.PlainMessage, err error) (*ExplicitVerifyMessage, error) {
|
||||
var explicitVerify *ExplicitVerifyMessage
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue