Package org.bouncycastle.openpgp.api
Class OpenPGPCertificate.OpenPGPSignatureChain
java.lang.Object
org.bouncycastle.openpgp.api.OpenPGPCertificate.OpenPGPSignatureChain
- All Implemented Interfaces:
Comparable<OpenPGPCertificate.OpenPGPSignatureChain>
,Iterable<OpenPGPCertificate.OpenPGPSignatureChain.Link>
- Enclosing class:
OpenPGPCertificate
public static class OpenPGPCertificate.OpenPGPSignatureChain
extends Object
implements Comparable<OpenPGPCertificate.OpenPGPSignatureChain>, Iterable<OpenPGPCertificate.OpenPGPSignatureChain.Link>
Chain of
signatures
.
Such a chain originates from a certificates primary key and points towards some certificate component that
is bound to the certificate.
As for example a subkey can only be bound by a primary key that holds either at least one
direct-key self-signature or at least one user-id binding signature, multiple signatures may form
a validity chain.
An OpenPGPCertificate.OpenPGPSignatureChain
can either be a certification
(isCertification()
), e.g. it represents a positive binding,
or it can be a revocation (isRevocation()
) which invalidates a positive binding.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
"Positive" signature chain link.static class
Link in aOpenPGPCertificate.OpenPGPSignatureChain
.static class
"Negative" signature chain link. -
Method Summary
Modifier and TypeMethodDescriptionint
Factory method for creating anOpenPGPCertificate.OpenPGPSignatureChain
with only a single link.Return the last link in the chain, which applies to the chains target component.Return theOpenPGPCertificate.OpenPGPComponentKey
to which the leaf link applies to.Return the first revocation signature in the chain, or null if the chain does not contain any revocations.Return the very first link in the chain.Return the issuer of the root link.Return the signature from the leaf of the chain, which directly applies to theOpenPGPCertificate.OpenPGPCertificateComponent
.Return a List of all signatures in the chain.getSince()
Return the date since which this signature chain is valid.getUntil()
Return the date until which the chain link is valid.boolean
Return true, if the chain only consists of non-revocation signatures and is therefore a certification chain.boolean
isEffectiveAt
(Date evaluationDate) Return true if the chain is effective at the given evaluation date, meaning all link signatures have been created before the evaluation time, and none signature expires before the evaluation time.boolean
Return true, if the chain contains at least one link that represents a hard revocation.boolean
Return true, if the chain contains at least one revocation signature.boolean
isValid()
Return true if the signature chain is valid, meaning all its chain links are valid.boolean
isValid
(PGPContentVerifierBuilderProvider contentVerifierBuilderProvider, OpenPGPPolicy policy) Return true if the signature chain is valid, meaning all its chain links are valid.iterator()
Return an NEW instance of theOpenPGPCertificate.OpenPGPSignatureChain
with the new link appended.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
getSignature
Return the signature from the leaf of the chain, which directly applies to theOpenPGPCertificate.OpenPGPCertificateComponent
.- Returns:
- signature
-
getRevocation
Return the first revocation signature in the chain, or null if the chain does not contain any revocations.- Returns:
- first revocation signature
-
getSignatures
Return a List of all signatures in the chain.- Returns:
- list of signatures
-
plus
public OpenPGPCertificate.OpenPGPSignatureChain plus(OpenPGPCertificate.OpenPGPComponentSignature sig) Return an NEW instance of theOpenPGPCertificate.OpenPGPSignatureChain
with the new link appended.- Parameters:
sig
- signature- Returns:
- new instance
-
direct
public static OpenPGPCertificate.OpenPGPSignatureChain direct(OpenPGPCertificate.OpenPGPComponentSignature sig) Factory method for creating anOpenPGPCertificate.OpenPGPSignatureChain
with only a single link.- Parameters:
sig
- signature- Returns:
- chain
-
getRootLink
Return the very first link in the chain. This is typically a link that originates from the issuing certificates primary key.- Returns:
- root link
-
getRootLinkIssuer
Return the issuer of the root link. This is typically the issuing certificates primary key.- Returns:
- root links issuer
-
getLeafLink
Return the last link in the chain, which applies to the chains target component.- Returns:
- leaf link
-
getLeafLinkTargetKey
Return theOpenPGPCertificate.OpenPGPComponentKey
to which the leaf link applies to. For subkey binding signatures, this is the subkey. For user-id certification signatures, it is the primary key.- Returns:
- target key component of the leaf link
-
isCertification
public boolean isCertification()Return true, if the chain only consists of non-revocation signatures and is therefore a certification chain.- Returns:
- true if the chain is a certification, false if it contains a revocation link.
-
isRevocation
public boolean isRevocation()Return true, if the chain contains at least one revocation signature.- Returns:
- true if the chain is a revocation.
-
isHardRevocation
public boolean isHardRevocation()Return true, if the chain contains at least one link that represents a hard revocation.- Returns:
- true if chain is hard revocation, false if it is a certification or soft revocation
-
getSince
Return the date since which this signature chain is valid. This is the creation time of the most recent link in the chain.- Returns:
- most recent signature creation time
-
getUntil
Return the date until which the chain link is valid. This is the earliest expiration time of any signature in the chain.- Returns:
- earliest expiration time
-
isEffectiveAt
Return true if the chain is effective at the given evaluation date, meaning all link signatures have been created before the evaluation time, and none signature expires before the evaluation time.- Parameters:
evaluationDate
- reference time- Returns:
- true if chain is effective at evaluation date
-
isValid
Return true if the signature chain is valid, meaning all its chain links are valid.- Returns:
- true if chain is valid
- Throws:
PGPSignatureException
- if an exception occurs during signature verification
-
isValid
public boolean isValid(PGPContentVerifierBuilderProvider contentVerifierBuilderProvider, OpenPGPPolicy policy) throws PGPSignatureException Return true if the signature chain is valid, meaning all its chain links are valid.- Parameters:
contentVerifierBuilderProvider
- provider for content verifier builderspolicy
- algorithm policy- Returns:
- true if chain is valid
- Throws:
PGPSignatureException
- if an exception occurs during signature verification
-
toString
-
compareTo
- Specified by:
compareTo
in interfaceComparable<OpenPGPCertificate.OpenPGPSignatureChain>
-
iterator
- Specified by:
iterator
in interfaceIterable<OpenPGPCertificate.OpenPGPSignatureChain.Link>
-