Class DefaultPGPPublicKeyAccessor
java.lang.Object
org.apache.camel.converter.crypto.DefaultPGPPublicKeyAccessor
- All Implemented Interfaces:
PGPPublicKeyAccessor
Caches a public key ring.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionList<org.bouncycastle.openpgp.PGPPublicKey>
getEncryptionKeys
(org.apache.camel.Exchange exchange, List<String> useridParts) Returns the encryption keys for the given user ID parts.org.bouncycastle.openpgp.PGPPublicKey
getPublicKey
(org.apache.camel.Exchange exchange, long keyId, List<String> userIdParts) Returns the public key with a certain key ID.
-
Constructor Details
-
DefaultPGPPublicKeyAccessor
public DefaultPGPPublicKeyAccessor(byte[] publicKeyRing) throws IOException, org.bouncycastle.openpgp.PGPException - Throws:
IOException
org.bouncycastle.openpgp.PGPException
-
-
Method Details
-
getEncryptionKeys
public List<org.bouncycastle.openpgp.PGPPublicKey> getEncryptionKeys(org.apache.camel.Exchange exchange, List<String> useridParts) throws Exception Description copied from interface:PGPPublicKeyAccessor
Returns the encryption keys for the given user ID parts. This method is used for encryption.- Specified by:
getEncryptionKeys
in interfacePGPPublicKeyAccessor
- Parameters:
exchange
- exchange, can benull
useridParts
- parts of User IDs, must not benull
- Returns:
- list of public keys, must not be
null
- Throws:
Exception
-
getPublicKey
public org.bouncycastle.openpgp.PGPPublicKey getPublicKey(org.apache.camel.Exchange exchange, long keyId, List<String> userIdParts) throws Exception Description copied from interface:PGPPublicKeyAccessor
Returns the public key with a certain key ID. This method is used for verifying the signature. The given User IDs are provided to filter the public key, further. If the User ID parts list is empty, then any public key can be returned which has the specified key ID. If the User ID parts list is not empty then the returned key must have a User ID which contains at least one User ID part.- Specified by:
getPublicKey
in interfacePGPPublicKeyAccessor
- Parameters:
exchange
- exchangekeyId
- key IDuserIdParts
- parts of User IDs, must not benull
, but can be empty- Returns:
- public key or
null
if the key cannot be found - Throws:
Exception
-