Package org.bouncycastle.openpgp.api
Class OpenPGPSignature.OpenPGPDocumentSignature
java.lang.Object
org.bouncycastle.openpgp.api.OpenPGPSignature
org.bouncycastle.openpgp.api.OpenPGPSignature.OpenPGPDocumentSignature
- Enclosing class:
OpenPGPSignature
An
OpenPGPSignature
made over a binary or textual document (e.g. a message).
Also known as a Data Signature.
An OpenPGPSignature.OpenPGPDocumentSignature
CANNOT live on a OpenPGPCertificate
.-
Nested Class Summary
Nested classes/interfaces inherited from class org.bouncycastle.openpgp.api.OpenPGPSignature
OpenPGPSignature.OpenPGPDocumentSignature, OpenPGPSignature.OpenPGPSignatureSubpacket
-
Field Summary
FieldsFields inherited from class org.bouncycastle.openpgp.api.OpenPGPSignature
isCorrect, issuer, isTested, signature
-
Constructor Summary
ConstructorsConstructorDescriptionOpenPGPDocumentSignature
(PGPSignature signature, OpenPGPCertificate.OpenPGPComponentKey issuer) Create a document signature of level 0 (signature is made directly over the document).OpenPGPDocumentSignature
(PGPSignature signature, OpenPGPCertificate.OpenPGPComponentKey issuer, OpenPGPSignature.OpenPGPDocumentSignature attestedSignature) Create a document signature of level greater than 0 (signature is made as an attestation over other signature(s) + document). -
Method Summary
Modifier and TypeMethodDescriptionboolean
createdInBounds
(Date notBefore, Date notAfter) Check, if the creation time of the signature is within the intervalReturn the attested signature (or null if this is not an attestation signature).int
Return the signature attestation level of this signature.protected String
boolean
isValid()
Return true, if the signature is valid at this moment.boolean
isValid
(OpenPGPPolicy policy) Return true, if the signature is valid at this moment using the given policy.boolean
Return true, if th signature is valid at the given date.boolean
isValidAt
(Date date, OpenPGPPolicy policy) Return true, if th signature is valid at the given date using the given policy.boolean
verify()
Verify the correctness of a prefixed-signature.boolean
Verify the correctness of an inline signature by evaluating the correspondingPGPOnePassSignature
.Methods inherited from class org.bouncycastle.openpgp.api.OpenPGPSignature
getCreationTime, getExpirationTime, getIssuer, getIssuerCertificate, getIssuerDisplay, getKeyIdentifier, getKeyIdentifiers, getMostExpressiveIdentifier, getSignature, getType, isCertification, isEffectiveAt, isHardRevocation, isRevocation, isTestedCorrect, toAsciiArmoredString, toString
-
Field Details
-
attestedSignature
-
-
Constructor Details
-
OpenPGPDocumentSignature
public OpenPGPDocumentSignature(PGPSignature signature, OpenPGPCertificate.OpenPGPComponentKey issuer) Create a document signature of level 0 (signature is made directly over the document).- Parameters:
signature
- signatureissuer
- public issuer-signing-key-component (or null if not available)
-
OpenPGPDocumentSignature
public OpenPGPDocumentSignature(PGPSignature signature, OpenPGPCertificate.OpenPGPComponentKey issuer, OpenPGPSignature.OpenPGPDocumentSignature attestedSignature) Create a document signature of level greater than 0 (signature is made as an attestation over other signature(s) + document). If the attested signature is itself an attestation, it will recursively contain its attested signature.- Parameters:
signature
- attestation signatureissuer
- public issuer signing-key-component (or null if not available)attestedSignature
- the attested signature
-
-
Method Details
-
getTargetDisplay
- Specified by:
getTargetDisplay
in classOpenPGPSignature
-
getSignatureLevel
public int getSignatureLevel()Return the signature attestation level of this signature. If this signature was created directly over a document, this method returns 0. A level greater than 0 indicates that the signature is an attestation over at least one other signature.- Returns:
- signature attestation level
-
getAttestedSignature
Return the attested signature (or null if this is not an attestation signature).- Returns:
- attested signature or null
-
verify
Verify the correctness of an inline signature by evaluating the correspondingPGPOnePassSignature
.- Parameters:
ops
- one-pass-signature packet- Returns:
- true if the signature is correct, false otherwise
- Throws:
PGPException
- if the signature cannot be verified
-
verify
Verify the correctness of a prefixed-signature.- Returns:
- true if the signature is correct, false otherwise
- Throws:
PGPException
- if the signature cannot be verified
-
isValid
Return true, if the signature is valid at this moment. A valid signature is effective, correct and was issued by a valid signing key.- Returns:
- true if the signature is valid now.
- Throws:
PGPSignatureException
-
isValid
Return true, if the signature is valid at this moment using the given policy. A valid signature is effective, correct and was issued by a valid signing key.- Parameters:
policy
- policy- Returns:
- true if the signature is valid now.
- Throws:
PGPSignatureException
-
isValidAt
Return true, if th signature is valid at the given date. A valid signature is effective, correct and was issued by a valid signing key.- Parameters:
date
- evaluation time- Returns:
- true if the signature is valid at the given date
- Throws:
IllegalStateException
- if the signature has not yet been tested using averify()
method.PGPSignatureException
-
isValidAt
Return true, if th signature is valid at the given date using the given policy. A valid signature is effective, correct and was issued by a valid signing key.- Parameters:
date
- evaluation timepolicy
- policy- Returns:
- true if the signature is valid at the given date
- Throws:
IllegalStateException
- if the signature has not yet been tested using averify()
method.PGPSignatureException
-
createdInBounds
Check, if the creation time of the signature is within the intervalnotBefore <= creationTime <= notAfter
- Parameters:
notBefore
- earliest accepted creation timenotAfter
- latest accepted creation time- Returns:
- true if sig was created in bounds, false otherwise
-