Class MessageMetadata
java.lang.Object
org.pgpainless.decryption_verification.MessageMetadata
View for extracting metadata about a
MessageMetadata.Message
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
static interface
static class
static class
static class
static interface
static interface
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn theCompressionAlgorithm
of the outermost compressed data packet, or null, if the message does not contain any compressed data packets.Return anIterator
ofCompressionAlgorithms
encountered in the message.Return theSubkeyIdentifier
of the decryption key that was used to decrypt the outermost encryption layer.Return theSymmetricKeyAlgorithm
of the outermost encrypted data packet, or null if message is unencrypted.Return anIterator
ofSymmetricKeyAlgorithms
encountered in the message.Return the value of the literal data packet's filename field.Return the value of the format field of the literal data packet.Return the value of the literal data packets modification date field.Return a list containing all recipient keyIDs.Return a list of all rejected detached signatures.Return a list of all rejected inline-signatures of the message.Similar togetVerifiedInlineSignaturesByLayer()
, this method returns all rejected inline-signatures of the message, but organized by layer.Return theSessionKey
of the outermost encrypted data packet.Return anIterator
ofSessionKeys
for all encrypted data packets in the message.Return a list of all verified detached signatures.Return a list of all verified inline-signatures.boolean
isAuthenticatablySignedBy
(String userId, boolean email, CertificateAuthority certificateAuthority) Return true, if the message was signed by a certificate for which we can authenticate a binding to the given userId.boolean
isAuthenticatablySignedBy
(String userId, boolean email, CertificateAuthority certificateAuthority, int targetAmount) Return true, if the message was verifiably signed by a certificate for which we can authenticate a binding to the given userId.boolean
boolean
isEncryptedFor
(org.bouncycastle.openpgp.PGPKeyRing keys) boolean
Returns true, if the filename of the literal data packet indicates that the data is intended for your eyes only.boolean
boolean
isVerifiedDetachedSignedBy
(org.bouncycastle.openpgp.PGPKeyRing keys) boolean
isVerifiedInlineSignedBy
(org.bouncycastle.openpgp.PGPKeyRing keys) boolean
boolean
isVerifiedSignedBy
(org.bouncycastle.openpgp.PGPKeyRing keys) Convert thisMessageMetadata
object into a legacyOpenPgpMetadata
object.
-
Field Details
-
message
-
-
Constructor Details
-
MessageMetadata
-
-
Method Details
-
toLegacyMetadata
Convert thisMessageMetadata
object into a legacyOpenPgpMetadata
object. This method is intended to be used for a transition period between the 1.3 / 1.4+ branches. TODO: Remove in 1.6.X- Returns:
- converted
OpenPgpMetadata
object
-
isUsingCleartextSignatureFramework
public boolean isUsingCleartextSignatureFramework() -
isEncrypted
public boolean isEncrypted() -
isEncryptedFor
public boolean isEncryptedFor(@Nonnull org.bouncycastle.openpgp.PGPKeyRing keys) -
isAuthenticatablySignedBy
public boolean isAuthenticatablySignedBy(String userId, boolean email, CertificateAuthority certificateAuthority) Return true, if the message was signed by a certificate for which we can authenticate a binding to the given userId.- Parameters:
userId
- userIdemail
- if true, treat the user-id as an email address and match all userIDs containing this addresscertificateAuthority
- certificate authority- Returns:
- true, if we can authenticate a binding for a signing key with sufficient evidence
-
isAuthenticatablySignedBy
public boolean isAuthenticatablySignedBy(String userId, boolean email, CertificateAuthority certificateAuthority, int targetAmount) Return true, if the message was verifiably signed by a certificate for which we can authenticate a binding to the given userId.- Parameters:
userId
- userIdemail
- if true, treat the user-id as an email address and match all userIDs containing this addresscertificateAuthority
- certificate authoritytargetAmount
- target trust amount- Returns:
- true, if we can authenticate a binding for a signing key with sufficient evidence
-
getRecipientKeyIds
Return a list containing all recipient keyIDs.- Returns:
- list of recipients
-
getEncryptionLayers
-
getEncryptionAlgorithm
Return theSymmetricKeyAlgorithm
of the outermost encrypted data packet, or null if message is unencrypted.- Returns:
- encryption algorithm
-
getEncryptionAlgorithms
Return anIterator
ofSymmetricKeyAlgorithms
encountered in the message. The first item returned by the iterator is the algorithm of the outermost encrypted data packet, the next item that of the next nested encrypted data packet and so on. The iterator might also be empty, in case of an unencrypted message.- Returns:
- iterator of symmetric encryption algorithms
-
getCompressionLayers
-
getCompressionAlgorithm
Return theCompressionAlgorithm
of the outermost compressed data packet, or null, if the message does not contain any compressed data packets.- Returns:
- compression algorithm
-
getCompressionAlgorithms
Return anIterator
ofCompressionAlgorithms
encountered in the message. The first item returned by the iterator is the algorithm of the outermost compressed data packet, the next item that of the next nested compressed data packet and so on. The iterator might also be empty, in case of a message without any compressed data packets.- Returns:
- iterator of compression algorithms
-
getSessionKey
Return theSessionKey
of the outermost encrypted data packet. If the message was unencrypted, this method returnsnull
.- Returns:
- session key of the message
-
getSessionKeys
Return anIterator
ofSessionKeys
for all encrypted data packets in the message. The first item returned by the iterator is the session key of the outermost encrypted data packet, the next item that of the next nested encrypted data packet and so on. The iterator might also be empty, in case of an unencrypted message.- Returns:
- iterator of session keys
-
isVerifiedSignedBy
public boolean isVerifiedSignedBy(@Nonnull org.bouncycastle.openpgp.PGPKeyRing keys) -
getVerifiedSignatures
-
isVerifiedDetachedSignedBy
public boolean isVerifiedDetachedSignedBy(@Nonnull org.bouncycastle.openpgp.PGPKeyRing keys) -
getVerifiedDetachedSignatures
Return a list of all verified detached signatures. This list contains all acceptable, correct detached signatures.- Returns:
- verified detached signatures
-
getRejectedDetachedSignatures
Return a list of all rejected detached signatures.- Returns:
- rejected detached signatures
-
isVerifiedInlineSignedBy
public boolean isVerifiedInlineSignedBy(@Nonnull org.bouncycastle.openpgp.PGPKeyRing keys) -
getVerifiedInlineSignatures
Return a list of all verified inline-signatures. This list contains all acceptable, correct signatures that were part of the message itself.- Returns:
- verified inline signatures
-
getVerifiedInlineSignaturesByLayer
Return anIterator
ofLists
of verified inline-signatures of the message. Since signatures might occur in different layers within a message, this method can be used to gain more detailed insights into what signatures were encountered at what layers of the message structure. Each item of theIterator
represents a layer of the message and contains only signatures from this layer. An empty list means no (or no acceptable) signatures were encountered in that layer.- Returns:
- iterator of lists of signatures by-layer.
-
getRejectedInlineSignatures
Return a list of all rejected inline-signatures of the message.- Returns:
- list of rejected inline-signatures
-
getRejectedInlineSignaturesByLayer
Similar togetVerifiedInlineSignaturesByLayer()
, this method returns all rejected inline-signatures of the message, but organized by layer.- Returns:
- rejected inline-signatures by-layer
-
getFilename
Return the value of the literal data packet's filename field. This value can be used to store a decrypted file under its original filename, but since this field is not necessarily part of the signed data of a message, usage of this field is discouraged.- Returns:
- filename
- See Also:
-
isForYourEyesOnly
public boolean isForYourEyesOnly()Returns true, if the filename of the literal data packet indicates that the data is intended for your eyes only.- Returns:
- isForYourEyesOnly
-
getModificationDate
Return the value of the literal data packets modification date field. This value can be used to restore the modification date of a decrypted file, but since this field is not necessarily part of the signed data, its use is discouraged.- Returns:
- modification date
- See Also:
-
getLiteralDataEncoding
Return the value of the format field of the literal data packet. This value indicates what format (text, binary data, ...) the data has. Since this field is not necessarily part of the signed data of a message, its usage is discouraged.- Returns:
- format
- See Also:
-
getDecryptionKey
Return theSubkeyIdentifier
of the decryption key that was used to decrypt the outermost encryption layer. If the message was unencrypted, this might returnnull
.- Returns:
- decryption key
-
isVerifiedSigned
public boolean isVerifiedSigned()
-