Class OpenPgpMetadata
java.lang.Object
org.pgpainless.decryption_verification.OpenPgpMetadata
Legacy class containing metadata about an OpenPGP message.
It is advised to use
MessageMetadata
instead.
TODO: Remove in 1.6.X-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionOpenPgpMetadata
(Set<Long> recipientKeyIds, SubkeyIdentifier decryptionKey, SessionKey sessionKey, CompressionAlgorithm algorithm, List<SignatureVerification> verifiedInbandSignatures, List<SignatureVerification.Failure> invalidInbandSignatures, List<SignatureVerification> verifiedDetachedSignatures, List<SignatureVerification.Failure> invalidDetachedSignatures, String fileName, Date modificationDate, StreamEncoding fileEncoding, boolean cleartextSigned) -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsVerifiedSignatureFrom
(org.bouncycastle.openpgp.PGPPublicKeyRing certificate) Return true, if the message contains at least one verified signature made by a key in the given certificate.boolean
containsVerifiedSignatureFrom
(OpenPgpFingerprint fingerprint) Return true, if the message contains at least one valid signature made by the key with the given fingerprint, false otherwise.static OpenPgpMetadata.Builder
Return theCompressionAlgorithm
that was used to compress the message.Return theSubkeyIdentifier
of the key that was used to decrypt the message.Return the encoding format of the encrypted / signed file.Return the name of the encrypted / signed file.Return the modification date of the encrypted / signed file.Return a set of key-ids the messages was encrypted for.Set
<org.bouncycastle.openpgp.PGPSignature> Return a set of all signatures on the message.Return the algorithm that was used to symmetrically encrypt the message.Map
<SubkeyIdentifier, org.bouncycastle.openpgp.PGPSignature> Return a map of all verified signatures on the message.boolean
Return true if the message was signed using the cleartext signature framework.boolean
Return true, if the message was encrypted.boolean
Return true, if the encrypted data is intended for your eyes only.boolean
isSigned()
Return true if the message contained at least one signature.boolean
Return true, if the message is signed and at least one signature on the message was verified successfully.
-
Constructor Details
-
OpenPgpMetadata
public OpenPgpMetadata(Set<Long> recipientKeyIds, SubkeyIdentifier decryptionKey, SessionKey sessionKey, CompressionAlgorithm algorithm, List<SignatureVerification> verifiedInbandSignatures, List<SignatureVerification.Failure> invalidInbandSignatures, List<SignatureVerification> verifiedDetachedSignatures, List<SignatureVerification.Failure> invalidDetachedSignatures, String fileName, Date modificationDate, StreamEncoding fileEncoding, boolean cleartextSigned)
-
-
Method Details
-
getRecipientKeyIds
Return a set of key-ids the messages was encrypted for.- Returns:
- recipient ids
-
isEncrypted
public boolean isEncrypted()Return true, if the message was encrypted.- Returns:
- true if encrypted, false otherwise
-
getDecryptionKey
Return theSubkeyIdentifier
of the key that was used to decrypt the message. This can be null if the message was decrypted using aPassphrase
, or if it was not encrypted at all (e.g. signed only).- Returns:
- subkey identifier of decryption key
-
getSymmetricKeyAlgorithm
Return the algorithm that was used to symmetrically encrypt the message.- Returns:
- encryption algorithm
-
getSessionKey
-
getCompressionAlgorithm
Return theCompressionAlgorithm
that was used to compress the message.- Returns:
- compression algorithm
-
getSignatures
Return a set of all signatures on the message. Note: This method returns just the signatures. There is no guarantee that the signatures are verified or even correct. UsegetVerifiedSignatures()
instead to get all verified signatures.- Returns:
- unverified and verified signatures
-
isSigned
public boolean isSigned()Return true if the message contained at least one signature. Note: This method does not reflect, whether the signature on the message is correct. UseisVerified()
instead to determine, if the message carries a verifiable signature.- Returns:
- true if message contains at least one unverified or verified signature, false otherwise.
-
getVerifiedSignatures
Return a map of all verified signatures on the message. The map contains verified signatures as value, with theSubkeyIdentifier
of the key that was used to verify the signature as the maps keys.- Returns:
- verified detached and one-pass signatures
-
getVerifiedInbandSignatures
-
getVerifiedDetachedSignatures
-
getInvalidInbandSignatures
-
getInvalidDetachedSignatures
-
isVerified
public boolean isVerified()Return true, if the message is signed and at least one signature on the message was verified successfully.- Returns:
- true if message is verified, false otherwise
-
containsVerifiedSignatureFrom
public boolean containsVerifiedSignatureFrom(org.bouncycastle.openpgp.PGPPublicKeyRing certificate) Return true, if the message contains at least one verified signature made by a key in the given certificate.- Parameters:
certificate
- certificate- Returns:
- true if message was signed by the certificate (and the signature is valid), false otherwise
-
containsVerifiedSignatureFrom
Return true, if the message contains at least one valid signature made by the key with the given fingerprint, false otherwise. The fingerprint might be of the signing subkey, or the primary key of the signing certificate.- Parameters:
fingerprint
- fingerprint of primary key or signing subkey- Returns:
- true if validly signed, false otherwise
-
getFileName
Return the name of the encrypted / signed file.- Returns:
- file name
-
isForYourEyesOnly
public boolean isForYourEyesOnly()Return true, if the encrypted data is intended for your eyes only.- Returns:
- true if for-your-eyes-only
-
getModificationDate
Return the modification date of the encrypted / signed file.- Returns:
- modification date
-
getFileEncoding
Return the encoding format of the encrypted / signed file.- Returns:
- encoding
-
isCleartextSigned
public boolean isCleartextSigned()Return true if the message was signed using the cleartext signature framework.- Returns:
- true if cleartext signed.
-
getBuilder
-