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 thePreferredAEADCiphersuites
that apply to this (sub-)key.getAEADCipherSuitePreferences
(Date evaluationTime) Return thePreferredAEADCiphersuites
that - at evaluation time - apply to this (sub-)key.getApplyingSubpacket
(Date evaluationTime, int subpacketType) Return theSignatureSubpacket
instance 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 theFeatures
signature subpacket that currently applies to the key.getFeatures
(Date evaluationTime) Return theFeatures
signature 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.OpenPGPComponentKey
Return theOpenPGPCertificate.OpenPGPComponentKey
belonging to thisOpenPGPCertificate.OpenPGPCertificateComponent
.Return theDate
, at which the key expires.getKeyExpirationDateAt
(Date evaluationTime) Return theDate
, at which the key - at evaluation time - expires.Return theKeyFlags
signature subpacket that currently applies to the key.getKeyFlags
(Date evaluationTime) Return theKeyFlags
signature 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.OpenPGPCertificateComponent
that belongs to this component.getRevocation
(Date evaluationTime) Return the (at evaluation time) latest revocation signature revoking this component.Return allOpenPGPCertificate.OpenPGPSignatureChains
that 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.boolean
hasKeyFlags
(Date evaluationTime, int... flags) Returnboolean
isBound()
Return true, if the component is currently validly bound to the certificate.boolean
Return true, if this component is - at evaluation time - properly bound to its certificate.abstract String
Return 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.OpenPGPSignatureChains
that 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.OpenPGPCertificateComponent
that 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 inMaps
that usecomponents
as map keys.- Returns:
- public certificate component
-
getKeyComponent
Return theOpenPGPCertificate.OpenPGPComponentKey
belonging to thisOpenPGPCertificate.OpenPGPCertificateComponent
. If thisOpenPGPCertificate.OpenPGPCertificateComponent
is an instance ofOpenPGPCertificate.OpenPGPComponentKey
, the method simply returnsthis
. If instead, theOpenPGPCertificate.OpenPGPCertificateComponent
is anOpenPGPCertificate.OpenPGPIdentityComponent
, the primary key it is bound to is returned. -
getKeyFlags
Return theKeyFlags
signature subpacket that currently applies to the key.- Returns:
- key flags subpacket
-
getKeyFlags
Return theKeyFlags
signature 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 (seeKeyFlags
for possible values)- Returns:
- true if the key has ANY of the provided flags
-
getFeatures
Return theFeatures
signature subpacket that currently applies to the key.- Returns:
- feature signature subpacket
-
getFeatures
Return theFeatures
signature subpacket that - at evaluation time - applies to the key.- Parameters:
evaluationTime
- evaluation time- Returns:
- features subpacket
-
getAEADCipherSuitePreferences
Return thePreferredAEADCiphersuites
that 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 thePreferredAEADCiphersuites
that - 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 theSignatureSubpacket
instance 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
-