Package org.bouncycastle.openpgp.api
Class OpenPGPCertificate.OpenPGPCertificateComponent
java.lang.Object
org.bouncycastle.openpgp.api.OpenPGPCertificate.OpenPGPCertificateComponent
- Direct Known Subclasses:
OpenPGPCertificate.OpenPGPComponentKey,OpenPGPCertificate.OpenPGPIdentityComponent
- Enclosing class:
OpenPGPCertificate
Component on an OpenPGP certificate.
Components can either be
keys or identities.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn thePreferredAEADCiphersuitesthat apply to this (sub-)key.getAEADCipherSuitePreferences(Date evaluationTime) Return thePreferredAEADCiphersuitesthat - at evaluation time - apply to this (sub-)key.getApplyingSubpacket(Date evaluationTime, int subpacketType) Return theSignatureSubpacketinstance of the given subpacketType, which currently applies to the key.Return this componentsOpenPGPCertificate.getCertification(Date evaluationTime) Return the (at evaluation time) latest certification signature binding this component.Return the compression algorithm preferences of this (sub-)key.getCompressionAlgorithmPreferences(Date evaluationTime) Return the compression algorithm preferences of this (sub-)key at evaluation time.Return theFeaturessignature subpacket that currently applies to the key.getFeatures(Date evaluationTime) Return theFeaturessignature subpacket that - at evaluation time - applies to the key.Return the current signature hash algorithm preferences of this (sub-)key.getHashAlgorithmPreferences(Date evaluationTime) Return the signature hash algorithm preferences of this (sub-)key at evaluation time.protected abstract OpenPGPCertificate.OpenPGPComponentKeyReturn theOpenPGPCertificate.OpenPGPComponentKeybelonging to thisOpenPGPCertificate.OpenPGPCertificateComponent.Return theDate, at which the key expires.getKeyExpirationDateAt(Date evaluationTime) Return theDate, at which the key - at evaluation time - expires.Return theKeyFlagssignature subpacket that currently applies to the key.getKeyFlags(Date evaluationTime) Return theKeyFlagssignature subpacket that - at evaluation time - applies to the key.Return the latest self-signature on the component.getLatestSelfSignature(Date evaluationTime) Return the (at evaluation time) latest self-signature on the component.getMergedDanglingExternalSignatureChainEndsFrom(OpenPGPCertificate thirdPartyCertificate, Date evaluationTime) Iterate over signatures issued over this component by the given 3rd-party certificate, merge them with the (at evaluation time) valid self-certification chain and return the results.Return the publicOpenPGPCertificate.OpenPGPCertificateComponentthat belongs to this component.getRevocation(Date evaluationTime) Return the (at evaluation time) latest revocation signature revoking this component.Return allOpenPGPCertificate.OpenPGPSignatureChainsthat bind this component.Return the current symmetric encryption algorithm preferences of this (sub-)key.getSymmetricCipherPreferences(Date evaluationTime) Return the symmetric encryption algorithm preferences of this (sub-)key at evaluation time.booleanhasKeyFlags(Date evaluationTime, int... flags) ReturnbooleanisBound()Return true, if the component is currently validly bound to the certificate.booleanReturn true, if this component is - at evaluation time - properly bound to its certificate.abstract StringReturn a detailed String representation of this component.
-
Constructor Details
-
OpenPGPCertificateComponent
-
-
Method Details
-
getCertificate
Return this componentsOpenPGPCertificate.- Returns:
- certificate
-
toDetailString
Return a detailed String representation of this component.- Returns:
- detailed String representation
-
isBound
public boolean isBound()Return true, if the component is currently validly bound to the certificate.- Returns:
- true if bound
-
isBoundAt
Return true, if this component is - at evaluation time - properly bound to its certificate.- Parameters:
evaluationTime- evaluation time- Returns:
- true if bound, false otherwise
-
getSignatureChains
Return allOpenPGPCertificate.OpenPGPSignatureChainsthat bind this component.- Returns:
- signature chains
-
getCertification
Return the (at evaluation time) latest certification signature binding this component.- Parameters:
evaluationTime- reference time- Returns:
- latest component certification signature
-
getRevocation
Return the (at evaluation time) latest revocation signature revoking this component.- Parameters:
evaluationTime- reference time- Returns:
- latest component revocation signature
-
getLatestSelfSignature
Return the latest self-signature on the component. That might either be a certification signature, or a revocation.- Returns:
- latest self signature
-
getLatestSelfSignature
public abstract OpenPGPCertificate.OpenPGPComponentSignature getLatestSelfSignature(Date evaluationTime) Return the (at evaluation time) latest self-signature on the component. That might either be a certification signature, or a revocation.- Parameters:
evaluationTime- reference time- Returns:
- latest self signature
-
getPublicComponent
Return the publicOpenPGPCertificate.OpenPGPCertificateComponentthat belongs to this component. For public components (pubkeys, identities...), that's simply this, while secret components return their corresponding public component. This is used to properly map secret key and public key components inMapsthat usecomponentsas map keys.- Returns:
- public certificate component
-
getKeyComponent
Return theOpenPGPCertificate.OpenPGPComponentKeybelonging to thisOpenPGPCertificate.OpenPGPCertificateComponent. If thisOpenPGPCertificate.OpenPGPCertificateComponentis an instance ofOpenPGPCertificate.OpenPGPComponentKey, the method simply returnsthis
. If instead, theOpenPGPCertificate.OpenPGPCertificateComponentis anOpenPGPCertificate.OpenPGPIdentityComponent, the primary key it is bound to is returned. -
getKeyFlags
Return theKeyFlagssignature subpacket that currently applies to the key.- Returns:
- key flags subpacket
-
getKeyFlags
Return theKeyFlagssignature subpacket that - at evaluation time - applies to the key.- Parameters:
evaluationTime- evaluation time- Returns:
- key flags subpacket
-
hasKeyFlags
Returntrue
, if the key has any of the given key flags.Note: To check if the key has EITHER flag A or B, call
hasKeyFlags(evalTime, A, B)
. To instead check, if the key has BOTH flags A AND B, callhasKeyFlags(evalTime, A & B)
.- Parameters:
evaluationTime- evaluation timeflags- key flags (seeKeyFlagsfor possible values)- Returns:
- true if the key has ANY of the provided flags
-
getFeatures
Return theFeaturessignature subpacket that currently applies to the key.- Returns:
- feature signature subpacket
-
getFeatures
Return theFeaturessignature subpacket that - at evaluation time - applies to the key.- Parameters:
evaluationTime- evaluation time- Returns:
- features subpacket
-
getAEADCipherSuitePreferences
Return thePreferredAEADCiphersuitesthat apply to this (sub-)key. Note: This refers to AEAD preferences as defined in rfc9580, NOT LibrePGP AEAD algorithms.- Returns:
- AEAD algorithm preferences
-
getAEADCipherSuitePreferences
Return thePreferredAEADCiphersuitesthat - at evaluation time - apply to this (sub-)key. Note: This refers to AEAD preferences as defined in rfc9580, NOT LibrePGP AEAD algorithms.- Parameters:
evaluationTime- evaluation time- Returns:
- AEAD algorithm preferences at evaluation time
-
getSymmetricCipherPreferences
Return the current symmetric encryption algorithm preferences of this (sub-)key.- Returns:
- current preferred symmetric-key algorithm preferences
-
getSymmetricCipherPreferences
Return the symmetric encryption algorithm preferences of this (sub-)key at evaluation time.- Parameters:
evaluationTime- evaluation time- Returns:
- current preferred symmetric-key algorithm preferences
-
getHashAlgorithmPreferences
Return the current signature hash algorithm preferences of this (sub-)key.- Returns:
- hash algorithm preferences
-
getHashAlgorithmPreferences
Return the signature hash algorithm preferences of this (sub-)key at evaluation time.- Parameters:
evaluationTime- evaluation time- Returns:
- hash algorithm preferences
-
getCompressionAlgorithmPreferences
Return the compression algorithm preferences of this (sub-)key.- Returns:
- compression algorithm preferences
-
getCompressionAlgorithmPreferences
Return the compression algorithm preferences of this (sub-)key at evaluation time.- Parameters:
evaluationTime- reference time- Returns:
- compression algorithm preferences
-
getKeyExpirationDate
Return theDate, at which the key expires.- Returns:
- key expiration time
-
getKeyExpirationDateAt
Return theDate, at which the key - at evaluation time - expires.- Parameters:
evaluationTime- evaluation time- Returns:
- key expiration time
-
getApplyingSubpacket
protected OpenPGPSignature.OpenPGPSignatureSubpacket getApplyingSubpacket(Date evaluationTime, int subpacketType) Return theSignatureSubpacketinstance of the given subpacketType, which currently applies to the key. Since subpackets from the Direct-Key signature apply to all subkeys of a certificate, this method first inspects the signature that immediately applies to this key (e.g. a subkey-binding signature), and - if the queried subpacket is found in there, returns that instance. Otherwise, indirectly applying signatures (e.g. Direct-Key signatures) are queried. That way, preferences from the direct-key signature are considered, but per-key overwrites take precedence.- Parameters:
evaluationTime- evaluation timesubpacketType- subpacket type that is being searched for- Returns:
- subpacket from directly or indirectly applying signature
- See Also:
-
getMergedDanglingExternalSignatureChainEndsFrom
protected OpenPGPCertificate.OpenPGPSignatureChains getMergedDanglingExternalSignatureChainEndsFrom(OpenPGPCertificate thirdPartyCertificate, Date evaluationTime) Iterate over signatures issued over this component by the given 3rd-party certificate, merge them with the (at evaluation time) valid self-certification chain and return the results.- Parameters:
thirdPartyCertificate- certificate of a 3rd partyevaluationTime- reference time- Returns:
- all 3rd party signatures on this component, merged with their issuer chains
-