public interface OpenPGPPolicy
| Modifier and Type | Interface and Description |
|---|---|
static class |
OpenPGPPolicy.OpenPGPNotationRegistry
The
OpenPGPPolicy.OpenPGPNotationRegistry can be used to register known notations, such that signatures containing
notation instances of the same name, which are marked as critical do not invalidate the signature. |
| Modifier and Type | Method and Description |
|---|---|
int |
getDefaultCertificationSignatureHashAlgorithm()
Return the default certification signature hash algorithm ID.
|
int |
getDefaultDocumentSignatureHashAlgorithm()
Return the default document signature hash algorithm ID.
|
int |
getDefaultSymmetricKeyAlgorithm()
Return the default symmetric-key algorithm, which is used as a fallback if symmetric encryption algorithm
negotiation fails.
|
long |
getMaximumDecompressedDataSize()
Return the maximum number of bytes a compressed data packet may decompress to before
message processing fails, or a negative value for no limit.
|
OpenPGPPolicy.OpenPGPNotationRegistry |
getNotationRegistry()
Return the policies
OpenPGPPolicy.OpenPGPNotationRegistry containing known notation names. |
boolean |
hasAcceptableCertificationSignatureHashAlgorithm(PGPSignature signature)
Return true, if the
PGPSignature uses an acceptable certification signature hash algorithm. |
boolean |
hasAcceptableDocumentSignatureHashAlgorithm(PGPSignature signature)
Return true, if the
PGPSignature uses an acceptable data/document signature hash algorithm. |
boolean |
hasAcceptableRevocationSignatureHashAlgorithm(PGPSignature signature)
Return true, if the
PGPSignature uses an acceptable revocation signature hash algorithm. |
boolean |
hasAcceptableSignatureHashAlgorithm(PGPSignature signature)
Return true, if the given
PGPSignature was made using an acceptable signature hash algorithm. |
boolean |
hasNoCriticalUnknownNotations(PGPSignature signature)
Return true, if the hashed subpacket area of the signature does NOT contain unknown critical notations.
|
boolean |
hasNoCriticalUnknownSubpackets(PGPSignature signature)
Return true, if the hashed subpacket area of the signature does NOT contain unknown critical subpackets.
|
boolean |
isAcceptableCertificationSignatureHashAlgorithm(int hashAlgorithmId,
java.util.Date signatureCreationTime)
Return true, if the given hash algorithm is - at signature creation time - an acceptable certification signature
hash algorithm.
|
boolean |
isAcceptableDecryptionKey(PGPPublicKey key)
Return true, if the given
PGPPublicKey is acceptable for decrypting messages. |
boolean |
isAcceptableDocumentSignatureHashAlgorithm(int hashAlgorithmId,
java.util.Date signatureCreationTime)
Return true, if the given hash algorithm is - at signature creation time - an acceptable document signature
hash algorithm.
|
boolean |
isAcceptableEncryptionKey(PGPPublicKey key)
Return true, if the given
PGPPublicKey is acceptable for encrypting messages. |
boolean |
isAcceptablePublicKey(PGPPublicKey key)
Return true, if the given
PGPPublicKey is acceptable. |
boolean |
isAcceptablePublicKeyStrength(int publicKeyAlgorithmId,
int bitStrength)
Return true, if the given bitStrength is acceptable for the given public key algorithm ID.
|
boolean |
isAcceptableRevocationSignatureHashAlgorithm(int hashAlgorithmId,
java.util.Date signatureCreationTime)
Return true, if the given hash algorithm is - at signature creation time - an acceptable revocation signature
hash algorithm.
|
boolean |
isAcceptableSignature(PGPSignature signature)
Return true, if the given
PGPSignature is acceptable (uses acceptable hash algorithm,
does not contain unknown critical notations or subpackets). |
boolean |
isAcceptableSigningKey(PGPPublicKey key)
Return true, if the given
PGPPublicKey is an acceptable signing key. |
boolean |
isAcceptableSymmetricKeyAlgorithm(int symmetricKeyAlgorithmId)
Return true, if the given symmetric-key algorithm is acceptable.
|
boolean |
isAcceptableVerificationKey(PGPPublicKey key)
Return true, if the given
PGPPublicKey is an acceptable signature verification key. |
boolean |
isKnownSignatureSubpacket(int signatureSubpacketTag)
Return true, if the given signature subpacket ID is known by the implementation.
|
boolean isAcceptableSigningKey(PGPPublicKey key)
PGPPublicKey is an acceptable signing key.
Note: Although signing requires a secret key, we perform checks on the public part for consistency.key - keyboolean isAcceptableVerificationKey(PGPPublicKey key)
PGPPublicKey is an acceptable signature verification key.
Note: The asymmetry between this and isAcceptableSigningKey(PGPPublicKey) is useful
to prevent creation of signatures using a legacy key, while still allowing verification of
signatures made using the same key.key - keyboolean isAcceptableEncryptionKey(PGPPublicKey key)
PGPPublicKey is acceptable for encrypting messages.key - keyboolean isAcceptableDecryptionKey(PGPPublicKey key)
PGPPublicKey is acceptable for decrypting messages.
Note: Although decryption requires a secret key, we perform checks on the public part for consistency.
The asymmetry between this and isAcceptableEncryptionKey(PGPPublicKey) is useful
to prevent creation of new encrypted messages using a legacy key, while still allowing decryption
of existing messages using the same key.key - keyboolean isAcceptablePublicKey(PGPPublicKey key)
PGPPublicKey is acceptable.key - keyboolean isAcceptableSignature(PGPSignature signature)
PGPSignature is acceptable (uses acceptable hash algorithm,
does not contain unknown critical notations or subpackets).
Note: A signature being acceptable does NOT mean that it is correct or valid.signature - signatureboolean hasAcceptableSignatureHashAlgorithm(PGPSignature signature)
PGPSignature was made using an acceptable signature hash algorithm.signature - signatureboolean hasAcceptableDocumentSignatureHashAlgorithm(PGPSignature signature)
PGPSignature uses an acceptable data/document signature hash algorithm.signature - data / document signatureboolean hasAcceptableRevocationSignatureHashAlgorithm(PGPSignature signature)
PGPSignature uses an acceptable revocation signature hash algorithm.signature - revocation signatureboolean hasAcceptableCertificationSignatureHashAlgorithm(PGPSignature signature)
PGPSignature uses an acceptable certification signature hash algorithm.signature - certification signatureboolean hasNoCriticalUnknownNotations(PGPSignature signature)
signature - signatureboolean hasNoCriticalUnknownSubpackets(PGPSignature signature)
signature - signatureboolean isKnownSignatureSubpacket(int signatureSubpacketTag)
SignatureSubpacketInputStream.signatureSubpacketTag - signature subpacket IDboolean isAcceptableDocumentSignatureHashAlgorithm(int hashAlgorithmId,
java.util.Date signatureCreationTime)
hashAlgorithmId - hash algorithm IDsignatureCreationTime - optional signature creation timeboolean isAcceptableRevocationSignatureHashAlgorithm(int hashAlgorithmId,
java.util.Date signatureCreationTime)
hashAlgorithmId - hash algorithm IDsignatureCreationTime - optional signature creation timeboolean isAcceptableCertificationSignatureHashAlgorithm(int hashAlgorithmId,
java.util.Date signatureCreationTime)
hashAlgorithmId - hash algorithm IDsignatureCreationTime - optional signature creation timeint getDefaultCertificationSignatureHashAlgorithm()
int getDefaultDocumentSignatureHashAlgorithm()
boolean isAcceptableSymmetricKeyAlgorithm(int symmetricKeyAlgorithmId)
symmetricKeyAlgorithmId - symmetric-key algorithmint getDefaultSymmetricKeyAlgorithm()
boolean isAcceptablePublicKeyStrength(int publicKeyAlgorithmId,
int bitStrength)
publicKeyAlgorithmId - ID of a public key algorithmbitStrength - key bit strengthlong getMaximumDecompressedDataSize()
An OpenPGP compressed data packet carries no decompressed-length field, so a small packet
can expand into an arbitrarily large amount of data (a "decompression bomb"). The nesting
limit (OpenPGPMessageInputStream.MAX_RECURSION) bounds how many compression layers
a message may carry but says nothing about how much any one of them may produce, so this
is the bound on the latter. It is applied per compressed data packet, as the bytes are
produced, which is the only point at which decompression can be stopped - a consumer
counting bytes off the returned stream has already paid the cost it is trying to avoid.
Exceeding it surfaces as a StreamOverflowException (an
IOException) from reading the
message input stream.
This mirrors the PGPCompressedData.getDataStream() /
PGPCompressedData.getDataStream(long) pair on the
low-level API: the default is unbounded, and bounding it is the caller's decision.
OpenPGPPolicy.OpenPGPNotationRegistry getNotationRegistry()
OpenPGPPolicy.OpenPGPNotationRegistry containing known notation names.