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 classstatic classstatic interfacestatic classstatic classstatic classstatic interfacestatic interface -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn theCompressionAlgorithmof the outermost compressed data packet, or null, if the message does not contain any compressed data packets.Return anIteratorofCompressionAlgorithmsencountered in the message.Return theSubkeyIdentifierof the decryption key that was used to decrypt the outermost encryption layer.Return theSymmetricKeyAlgorithmof the outermost encrypted data packet, or null if message is unencrypted.Return anIteratorofSymmetricKeyAlgorithmsencountered 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 theSessionKeyof the outermost encrypted data packet.Return anIteratorofSessionKeysfor all encrypted data packets in the message.Return a list of all verified detached signatures.Return a list of all verified inline-signatures.booleanisAuthenticatablySignedBy(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.booleanisAuthenticatablySignedBy(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.booleanbooleanisEncryptedFor(org.bouncycastle.openpgp.PGPKeyRing keys) booleanReturns true, if the filename of the literal data packet indicates that the data is intended for your eyes only.booleanbooleanisVerifiedDetachedSignedBy(org.bouncycastle.openpgp.PGPKeyRing keys) booleanisVerifiedInlineSignedBy(org.bouncycastle.openpgp.PGPKeyRing keys) booleanbooleanisVerifiedSignedBy(org.bouncycastle.openpgp.PGPKeyRing keys) Convert thisMessageMetadataobject into a legacyOpenPgpMetadataobject.
-
Field Details
-
message
-
-
Constructor Details
-
MessageMetadata
-
-
Method Details
-
toLegacyMetadata
Convert thisMessageMetadataobject into a legacyOpenPgpMetadataobject. 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
OpenPgpMetadataobject
-
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 theSymmetricKeyAlgorithmof the outermost encrypted data packet, or null if message is unencrypted.- Returns:
- encryption algorithm
-
getEncryptionAlgorithms
Return anIteratorofSymmetricKeyAlgorithmsencountered 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 theCompressionAlgorithmof the outermost compressed data packet, or null, if the message does not contain any compressed data packets.- Returns:
- compression algorithm
-
getCompressionAlgorithms
Return anIteratorofCompressionAlgorithmsencountered 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 theSessionKeyof the outermost encrypted data packet. If the message was unencrypted, this method returnsnull
.- Returns:
- session key of the message
-
getSessionKeys
Return anIteratorofSessionKeysfor 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 anIteratorofListsof 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 theIteratorrepresents 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 theSubkeyIdentifierof 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()
-