Package org.pgpainless.signature
Class OnePassSignature
- java.lang.Object
-
- org.pgpainless.signature.OnePassSignature
-
public class OnePassSignature extends java.lang.Object
Tuple-class that bundles together aPGPOnePassSignature
object, aPGPPublicKeyRing
destined to verify the signature, thePGPSignature
itself and a record of whether or not the signature was verified.
-
-
Constructor Summary
Constructors Constructor Description OnePassSignature(org.bouncycastle.openpgp.PGPOnePassSignature onePassSignature, org.bouncycastle.openpgp.PGPPublicKeyRing verificationKeys)
Create a newOnePassSignature
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OpenPgpV4Fingerprint
getFingerprint()
Return theOpenPgpV4Fingerprint
of the signing key.org.bouncycastle.openpgp.PGPOnePassSignature
getOnePassSignature()
Return thePGPOnePassSignature
object.org.bouncycastle.openpgp.PGPSignature
getSignature()
Return the signature.org.bouncycastle.openpgp.PGPPublicKeyRing
getVerificationKeys()
Return the key ring used to verify the signature.boolean
isVerified()
Return true if the signature is verified.boolean
verify(org.bouncycastle.openpgp.PGPSignature signature)
Verify the one-pass signature.
-
-
-
Constructor Detail
-
OnePassSignature
public OnePassSignature(org.bouncycastle.openpgp.PGPOnePassSignature onePassSignature, org.bouncycastle.openpgp.PGPPublicKeyRing verificationKeys)
Create a newOnePassSignature
.- Parameters:
onePassSignature
- one-pass signature packet used to initialize the signature verifier.verificationKeys
- verification keys
-
-
Method Detail
-
isVerified
public boolean isVerified()
Return true if the signature is verified.- Returns:
- verified
-
getOnePassSignature
public org.bouncycastle.openpgp.PGPOnePassSignature getOnePassSignature()
Return thePGPOnePassSignature
object.- Returns:
- onePassSignature
-
getFingerprint
public OpenPgpV4Fingerprint getFingerprint()
Return theOpenPgpV4Fingerprint
of the signing key.- Returns:
- signing key fingerprint
-
verify
public boolean verify(org.bouncycastle.openpgp.PGPSignature signature) throws org.bouncycastle.openpgp.PGPException
Verify the one-pass signature. Note: This method only checks if the signature itself is correct. It does not check if the signing key was eligible to create the signature, or if the signature is expired etc. Those checks are being done bySignatureVerifyingInputStream
.- Parameters:
signature
- parsed-out signature- Returns:
- true if the signature was verified, false otherwise
- Throws:
org.bouncycastle.openpgp.PGPException
- if signature verification fails with an exception.
-
getSignature
public org.bouncycastle.openpgp.PGPSignature getSignature()
Return the signature.- Returns:
- signature
-
getVerificationKeys
public org.bouncycastle.openpgp.PGPPublicKeyRing getVerificationKeys()
Return the key ring used to verify the signature.- Returns:
- verification keys
-
-