Class OpenPgpMetadata


  • public class OpenPgpMetadata
    extends java.lang.Object
    • Method Detail

      • getRecipientKeyIds

        @Nonnull
        public java.util.Set<java.lang.Long> 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

        @Nullable
        public SubkeyIdentifier getDecryptionKey()
        Return the SubkeyIdentifier of the key that was used to decrypt the message. This can be null if the message was decrypted using a Passphrase, or if it was not encrypted at all (eg. signed only).
        Returns:
        subkey identifier of decryption key
      • getSymmetricKeyAlgorithm

        @Nullable
        public SymmetricKeyAlgorithm getSymmetricKeyAlgorithm()
        Return the algorithm that was used to symmetrically encrypt the message.
        Returns:
        encryption algorithm
      • getSignatures

        @Nonnull
        public java.util.Set<org.bouncycastle.openpgp.PGPSignature> 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. Use getVerifiedSignatures() 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. Use isVerified() 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

        public java.util.Map<SubkeyIdentifier,​org.bouncycastle.openpgp.PGPSignature> getVerifiedSignatures()
        Return a map of all verified signatures on the message. The map contains verified signatures as value, with the SubkeyIdentifier of the key that was used to verify the signature as the maps keys.
        Returns:
        verified detached and one-pass signatures
      • getVerifiedInbandSignatures

        public java.util.List<SignatureVerification> getVerifiedInbandSignatures()
      • getVerifiedDetachedSignatures

        public java.util.List<SignatureVerification> getVerifiedDetachedSignatures()
      • 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

        public boolean containsVerifiedSignatureFrom​(OpenPgpV4Fingerprint fingerprint)
        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

        public java.lang.String 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

        public java.util.Date getModificationDate()
        Return the modification date of the encrypted / signed file.
        Returns:
        modification date
      • getFileEncoding

        public StreamEncoding getFileEncoding()
        Return the encoding format of the encrypted / signed file.
        Returns:
        encoding