org.apache.camel.converter.crypto
Class PGPDataFormat

java.lang.Object
  extended by org.apache.camel.converter.crypto.PGPDataFormat
All Implemented Interfaces:
org.apache.camel.spi.DataFormat

public class PGPDataFormat
extends Object
implements org.apache.camel.spi.DataFormat

PGPDataFormat uses the bouncy castle libraries to enable encryption and decryption in the PGP format.


Field Summary
static String ENCRYPTION_KEY_RING
           
static String KEY_FILE_NAME
           
static String KEY_PASSWORD
           
static String KEY_USERID
           
static String SIGNATURE_KEY_FILE_NAME
           
static String SIGNATURE_KEY_PASSWORD
           
static String SIGNATURE_KEY_RING
           
static String SIGNATURE_KEY_USERID
           
 
Constructor Summary
PGPDataFormat()
           
 
Method Summary
protected  org.bouncycastle.openpgp.PGPSignatureGenerator createSignatureGenerator(org.apache.camel.Exchange exchange, OutputStream out)
           
protected  byte[] findEncryptionKeyRing(org.apache.camel.Exchange exchange)
           
protected  String findKeyFileName(org.apache.camel.Exchange exchange)
           
protected  String findKeyPassword(org.apache.camel.Exchange exchange)
           
protected  String findKeyUserid(org.apache.camel.Exchange exchange)
           
protected  String findSignatureKeyFileName(org.apache.camel.Exchange exchange)
           
protected  String findSignatureKeyPassword(org.apache.camel.Exchange exchange)
           
protected  byte[] findSignatureKeyRing(org.apache.camel.Exchange exchange)
           
protected  String findSignatureKeyUserid(org.apache.camel.Exchange exchange)
           
 boolean getArmored()
           
 byte[] getEncryptionKeyRing()
           
 boolean getIntegrity()
           
 String getKeyFileName()
           
 String getKeyUserid()
           
 String getPassword()
           
protected  org.bouncycastle.openpgp.PGPOnePassSignature getSignature(org.apache.camel.Exchange exchange, org.bouncycastle.openpgp.PGPOnePassSignatureList signatureList)
           
 String getSignatureKeyFileName()
           
 byte[] getSignatureKeyRing()
           
 String getSignatureKeyUserid()
           
 String getSignaturePassword()
           
 void marshal(org.apache.camel.Exchange exchange, Object graph, OutputStream outputStream)
           
 void setArmored(boolean armored)
          Sets if the encrypted file should be written in ascii visible text
 void setEncryptionKeyRing(byte[] encryptionKeyRing)
           
 void setIntegrity(boolean integrity)
          Whether or not to add a integrity check/sign to the encrypted file
 void setKeyFileName(String keyFileName)
          filename of the keyring that will be used, classpathResource
 void setKeyUserid(String keyUserid)
          Userid of the key used to encrypt/decrypt
 void setPassword(String password)
          Password used to open the private keyring
 void setSignatureKeyFileName(String signatureKeyFileName)
          filename of the signature keyring that will be used, classpathResource
 void setSignatureKeyRing(byte[] signatureKeyRing)
           
 void setSignatureKeyUserid(String signatureKeyUserid)
          Userid of the signature key used to sign/verify
 void setSignaturePassword(String signaturePassword)
          Password used to open the signature private keyring
 Object unmarshal(org.apache.camel.Exchange exchange, InputStream encryptedStream)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_FILE_NAME

public static final String KEY_FILE_NAME
See Also:
Constant Field Values

ENCRYPTION_KEY_RING

public static final String ENCRYPTION_KEY_RING
See Also:
Constant Field Values

KEY_USERID

public static final String KEY_USERID
See Also:
Constant Field Values

KEY_PASSWORD

public static final String KEY_PASSWORD
See Also:
Constant Field Values

SIGNATURE_KEY_FILE_NAME

public static final String SIGNATURE_KEY_FILE_NAME
See Also:
Constant Field Values

SIGNATURE_KEY_RING

public static final String SIGNATURE_KEY_RING
See Also:
Constant Field Values

SIGNATURE_KEY_USERID

public static final String SIGNATURE_KEY_USERID
See Also:
Constant Field Values

SIGNATURE_KEY_PASSWORD

public static final String SIGNATURE_KEY_PASSWORD
See Also:
Constant Field Values
Constructor Detail

PGPDataFormat

public PGPDataFormat()
Method Detail

findKeyFileName

protected String findKeyFileName(org.apache.camel.Exchange exchange)

findEncryptionKeyRing

protected byte[] findEncryptionKeyRing(org.apache.camel.Exchange exchange)

findKeyUserid

protected String findKeyUserid(org.apache.camel.Exchange exchange)

findKeyPassword

protected String findKeyPassword(org.apache.camel.Exchange exchange)

findSignatureKeyFileName

protected String findSignatureKeyFileName(org.apache.camel.Exchange exchange)

findSignatureKeyRing

protected byte[] findSignatureKeyRing(org.apache.camel.Exchange exchange)

findSignatureKeyUserid

protected String findSignatureKeyUserid(org.apache.camel.Exchange exchange)

findSignatureKeyPassword

protected String findSignatureKeyPassword(org.apache.camel.Exchange exchange)

marshal

public void marshal(org.apache.camel.Exchange exchange,
                    Object graph,
                    OutputStream outputStream)
             throws Exception
Specified by:
marshal in interface org.apache.camel.spi.DataFormat
Throws:
Exception

createSignatureGenerator

protected org.bouncycastle.openpgp.PGPSignatureGenerator createSignatureGenerator(org.apache.camel.Exchange exchange,
                                                                                  OutputStream out)
                                                                           throws IOException,
                                                                                  org.bouncycastle.openpgp.PGPException,
                                                                                  NoSuchProviderException,
                                                                                  NoSuchAlgorithmException
Throws:
IOException
org.bouncycastle.openpgp.PGPException
NoSuchProviderException
NoSuchAlgorithmException

unmarshal

public Object unmarshal(org.apache.camel.Exchange exchange,
                        InputStream encryptedStream)
                 throws Exception
Specified by:
unmarshal in interface org.apache.camel.spi.DataFormat
Throws:
Exception

getSignature

protected org.bouncycastle.openpgp.PGPOnePassSignature getSignature(org.apache.camel.Exchange exchange,
                                                                    org.bouncycastle.openpgp.PGPOnePassSignatureList signatureList)
                                                             throws IOException,
                                                                    org.bouncycastle.openpgp.PGPException,
                                                                    NoSuchProviderException
Throws:
IOException
org.bouncycastle.openpgp.PGPException
NoSuchProviderException

setArmored

public void setArmored(boolean armored)
Sets if the encrypted file should be written in ascii visible text


getArmored

public boolean getArmored()

setIntegrity

public void setIntegrity(boolean integrity)
Whether or not to add a integrity check/sign to the encrypted file


getIntegrity

public boolean getIntegrity()

setKeyUserid

public void setKeyUserid(String keyUserid)
Userid of the key used to encrypt/decrypt


getKeyUserid

public String getKeyUserid()

setKeyFileName

public void setKeyFileName(String keyFileName)
filename of the keyring that will be used, classpathResource


getKeyFileName

public String getKeyFileName()

setPassword

public void setPassword(String password)
Password used to open the private keyring


getPassword

public String getPassword()

setSignatureKeyUserid

public void setSignatureKeyUserid(String signatureKeyUserid)
Userid of the signature key used to sign/verify


getSignatureKeyUserid

public String getSignatureKeyUserid()

setSignatureKeyFileName

public void setSignatureKeyFileName(String signatureKeyFileName)
filename of the signature keyring that will be used, classpathResource


getSignatureKeyFileName

public String getSignatureKeyFileName()

setSignaturePassword

public void setSignaturePassword(String signaturePassword)
Password used to open the signature private keyring


getSignaturePassword

public String getSignaturePassword()

getEncryptionKeyRing

public byte[] getEncryptionKeyRing()

setEncryptionKeyRing

public void setEncryptionKeyRing(byte[] encryptionKeyRing)

getSignatureKeyRing

public byte[] getSignatureKeyRing()

setSignatureKeyRing

public void setSignatureKeyRing(byte[] signatureKeyRing)


Apache Camel