Package org.bouncycastle.openpgp.api
Class OpenPGPSignature
java.lang.Object
org.bouncycastle.openpgp.api.OpenPGPSignature
- Direct Known Subclasses:
OpenPGPCertificate.OpenPGPComponentSignature
,OpenPGPSignature.OpenPGPDocumentSignature
An OpenPGP signature.
This is a wrapper around
PGPSignature
which tracks the verification state of the signature.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
AnOpenPGPSignature
made over a binary or textual document (e.g.static final class
SignatureSubpacket
and theOpenPGPSignature
that contains it. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected final OpenPGPCertificate.OpenPGPComponentKey
protected boolean
protected final PGPSignature
-
Constructor Summary
ConstructorsConstructorDescriptionOpenPGPSignature
(PGPSignature signature, OpenPGPCertificate.OpenPGPComponentKey issuer) Create anOpenPGPSignature
. -
Method Summary
Modifier and TypeMethodDescriptionReturn the creation time of the signature.Return the expiration time of the signature.Return theOpenPGPCertificate.OpenPGPComponentKey
subkey that issued this signature.Return theOpenPGPCertificate
that contains the subkey that issued this signature.protected String
Return the most expressiveKeyIdentifier
from available candidates.Return aList
of possibleKeyIdentifier
candidates.static KeyIdentifier
getMostExpressiveIdentifier
(List<KeyIdentifier> identifiers) Return the most expressive issuerKeyIdentifier
.Return thePGPSignature
.protected abstract String
protected String
getType()
boolean
Return true, if this signature is a certification.boolean
isEffectiveAt
(Date evaluationTime) Return true, if the signature is not a hard revocation, and if the evaluation time falls into the period between signature creation time and expiration or revocation.boolean
Return true, if this signature is a hard revocation.boolean
Return true, if this signature is a revocation, false otherwise.boolean
Return true, if this signature has been tested and is correct.Return an ASCII armored String representation of the signature.toString()
-
Field Details
-
signature
-
issuer
-
isTested
protected boolean isTested -
isCorrect
protected boolean isCorrect
-
-
Constructor Details
-
OpenPGPSignature
Create anOpenPGPSignature
.- Parameters:
signature
- signatureissuer
- issuer subkey
-
-
Method Details
-
getSignature
Return thePGPSignature
.- Returns:
- signature
-
getIssuer
Return theOpenPGPCertificate.OpenPGPComponentKey
subkey that issued this signature. This method might return null, if the issuer certificate is not available.- Returns:
- issuer subkey or null
-
getIssuerCertificate
Return theOpenPGPCertificate
that contains the subkey that issued this signature. This method might return null if the issuer certificate is not available- Returns:
- issuer certificate or null
-
getKeyIdentifiers
Return aList
of possibleKeyIdentifier
candidates.- Returns:
- key identifier candidates
-
getKeyIdentifier
Return the most expressiveKeyIdentifier
from available candidates.- Returns:
- most expressive key identifier
-
getMostExpressiveIdentifier
Return the most expressive issuerKeyIdentifier
. Due to historic reasons, signatures MAY contain more than one issuer packet, which might contain inconsistent information (issuer key-ids / issuer fingerprints). Throw wildcards (anonymous issuers) into the mix, and it becomes apparent, that there needs to be a way to select the "best" issuer identifier. If there are more than one issuer packet, this method returns the most expressive (prefer fingerprints over key-ids, prefer non-wildcard over wildcard) and returns that.- Parameters:
identifiers
- list of available identifiers- Returns:
- the best identifier
-
isTestedCorrect
public boolean isTestedCorrect()Return true, if this signature has been tested and is correct.- Returns:
- true if the signature is tested and is correct, false otherwise
-
getCreationTime
Return the creation time of the signature.- Returns:
- signature creation time
-
getExpirationTime
Return the expiration time of the signature. If no expiration time was included (or if the signature was explicitly marked as non-expiring), return null, otherwise return the time of expiration. The signature is no longer valid, once the expiration time is exceeded.- Returns:
- expiration time
-
isEffectiveAt
Return true, if the signature is not a hard revocation, and if the evaluation time falls into the period between signature creation time and expiration or revocation.- Parameters:
evaluationTime
- time for which you want to determine effectiveness of the signature- Returns:
- true if the signature is effective at the given evaluation time
-
isHardRevocation
public boolean isHardRevocation()Return true, if this signature is a hard revocation. Contrary to soft revocations (the key / signature / user-id was gracefully retired), a hard revocation has a serious reason, like key compromise, or no reason at all. Hard revocations invalidate the key / signature / user-id retroactively, while soft revocations only invalidate from the time of revocation signature creation onwards.- Returns:
- true if the signature is a hard revocation
-
isCertification
public boolean isCertification()Return true, if this signature is a certification. Certification signatures are used to bind user-ids to a key.- Returns:
- true if the signature is a certification
-
isRevocation
public boolean isRevocation()Return true, if this signature is a revocation, false otherwise.- Returns:
- true if signature is revocation
-
toString
-
getIssuerDisplay
-
getTargetDisplay
-
getType
-
toAsciiArmoredString
Return an ASCII armored String representation of the signature. If the signature contains issuer information, the fingerprint or key-id of the issuer will be added to the ASCII armor as a comment header.- Returns:
- ASCII armored signature
- Throws:
IOException
- if the signature cannot be encoded
-