Class OpenPgpMetadata

java.lang.Object
org.pgpainless.decryption_verification.OpenPgpMetadata

public class OpenPgpMetadata extends Object
  • Constructor Details

  • Method Details

    • getRecipientKeyIds

      @Nonnull public Set<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 (e.g. 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
    • getSessionKey

      @Nullable public SessionKey getSessionKey()
    • getCompressionAlgorithm

      @Nullable public CompressionAlgorithm getCompressionAlgorithm()
      Return the CompressionAlgorithm that was used to compress the message.
      Returns:
      compression algorithm
    • getSignatures

      @Nonnull public 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 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 List<SignatureVerification> getVerifiedInbandSignatures()
    • getVerifiedDetachedSignatures

      public List<SignatureVerification> getVerifiedDetachedSignatures()
    • getInvalidInbandSignatures

      public List<SignatureVerification.Failure> getInvalidInbandSignatures()
    • getInvalidDetachedSignatures

      public List<SignatureVerification.Failure> 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

      public 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. 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 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 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
    • isCleartextSigned

      public boolean isCleartextSigned()
      Return true if the message was signed using the cleartext signature framework.
      Returns:
      true if cleartext signed.
    • getBuilder

      public static OpenPgpMetadata.Builder getBuilder()