org.apache.camel.converter.crypto
Class DefaultPGPSecretKeyAccessor

java.lang.Object
  extended by org.apache.camel.converter.crypto.DefaultPGPSecretKeyAccessor
All Implemented Interfaces:
PGPSecretKeyAccessor

public class DefaultPGPSecretKeyAccessor
extends Object
implements PGPSecretKeyAccessor

Caches a Secret Keyring. Assumes that the password for all private keys is the same.


Constructor Summary
DefaultPGPSecretKeyAccessor(byte[] secretKeyRing, String password, String provider)
           
 
Method Summary
 org.bouncycastle.openpgp.PGPPrivateKey getPrivateKey(org.apache.camel.Exchange exchange, long keyId)
          Returns the private key with a certain key ID.
 List<PGPSecretKeyAndPrivateKeyAndUserId> getSignerKeys(org.apache.camel.Exchange exchange, List<String> useridParts)
          Returns the signer keys for the given user ID parts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPGPSecretKeyAccessor

public DefaultPGPSecretKeyAccessor(byte[] secretKeyRing,
                                   String password,
                                   String provider)
                            throws org.bouncycastle.openpgp.PGPException,
                                   IOException
Parameters:
secretKeyRing - secret key ring as byte array
password - password for the private keys, assuming that all private keys have the same password
provider -
Throws:
org.bouncycastle.openpgp.PGPException
IOException
Method Detail

getSignerKeys

public List<PGPSecretKeyAndPrivateKeyAndUserId> getSignerKeys(org.apache.camel.Exchange exchange,
                                                              List<String> useridParts)
                                                       throws Exception
Description copied from interface: PGPSecretKeyAccessor
Returns the signer keys for the given user ID parts. This method is used for signing.

Specified by:
getSignerKeys in interface PGPSecretKeyAccessor
Parameters:
exchange - exchange, can be null
useridParts - parts of User IDs, can be null or empty, then an empty list must be returned
Returns:
list of secret keys with their private keys and User Ids which corresponds to one of the useridParts, must not be null, can be empty
Throws:
Exception

getPrivateKey

public org.bouncycastle.openpgp.PGPPrivateKey getPrivateKey(org.apache.camel.Exchange exchange,
                                                            long keyId)
                                                     throws Exception
Description copied from interface: PGPSecretKeyAccessor
Returns the private key with a certain key ID. This method is used for decrypting.

Specified by:
getPrivateKey in interface PGPSecretKeyAccessor
Parameters:
exchange - exchange, can be null
keyId - key ID
Returns:
private key or null if the key cannot be found
Throws:
Exception


Apache Camel