|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.camel.support.ServiceSupport org.apache.camel.converter.crypto.PGPKeyAccessDataFormat org.apache.camel.converter.crypto.PGPDataFormat
public class PGPDataFormat
PGPDataFormat
uses the bouncy castle libraries to
enable encryption and decryption in the PGP format.
See also PGPKeyAccessDataFormat
.
Field Summary | |
---|---|
static String |
ENCRYPTION_KEY_RING
|
static String |
KEY_FILE_NAME
|
static String |
KEY_PASSWORD
|
static String |
SIGNATURE_KEY_FILE_NAME
|
static String |
SIGNATURE_KEY_PASSWORD
|
static String |
SIGNATURE_KEY_RING
|
Fields inherited from class org.apache.camel.support.ServiceSupport |
---|
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending |
Constructor Summary | |
---|---|
PGPDataFormat()
|
Method Summary | |
---|---|
List<PGPSecretKeyAndPrivateKeyAndUserId> |
determineSecretKeysWithPrivateKeyAndUserId(org.apache.camel.Exchange exchange,
String sigKeyFileName,
List<String> sigKeyUserids,
String sigKeyPassword,
byte[] sigKeyRing)
|
Map<String,String> |
determineSignatureKeyUserId2Password(List<String> sigKeyUserids,
String sigKeyPassword)
|
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 |
findSignatureKeyFileName(org.apache.camel.Exchange exchange)
|
protected String |
findSignatureKeyPassword(org.apache.camel.Exchange exchange)
|
protected byte[] |
findSignatureKeyRing(org.apache.camel.Exchange exchange)
|
byte[] |
getEncryptionKeyRing()
|
List<org.bouncycastle.openpgp.PGPPublicKey> |
getEncryptionKeys(org.apache.camel.Exchange exchange,
List<String> useridParts)
Returns the encryption keys for the given user ID parts. |
String |
getKeyFileName()
|
PGPPassphraseAccessor |
getPassphraseAccessor()
|
String |
getPassword()
|
org.bouncycastle.openpgp.PGPPrivateKey |
getPrivateKey(org.apache.camel.Exchange exchange,
long keyId)
Returns the private key with a certain key ID. |
org.bouncycastle.openpgp.PGPPublicKey |
getPublicKey(org.apache.camel.Exchange exchange,
long keyId,
List<String> userIdParts)
Returns the public key with a certain key ID. |
String |
getSignatureKeyFileName()
|
byte[] |
getSignatureKeyRing()
|
String |
getSignaturePassword()
|
List<PGPSecretKeyAndPrivateKeyAndUserId> |
getSignerKeys(org.apache.camel.Exchange exchange,
List<String> useridParts)
Returns the signer keys for the given user ID parts. |
void |
setEncryptionKeyRing(byte[] encryptionKeyRing)
Keyring used for encryption/decryption as byte array. |
void |
setKeyFileName(String keyFileName)
Filename of the keyring that will be used for the encryption/decryption, classpathResource. |
void |
setPassphraseAccessor(PGPPassphraseAccessor passphraseAccessor)
Alternative way to provide the passphrases. |
void |
setPassword(String password)
Password used to open the private key in secret keyring for decryption (unmarshaling). |
void |
setPublicKeyAccessor(PGPPublicKeyAccessor publicKeyAccessor)
|
void |
setSecretKeyAccessor(PGPSecretKeyAccessor secretKeyAccessor)
|
void |
setSignatureKeyFileName(String signatureKeyFileName)
Filename of the signature keyring that will be used, classpathResource. |
void |
setSignatureKeyRing(byte[] signatureKeyRing)
Keyring used for signing/verifying as byte array. |
void |
setSignaturePassword(String signaturePassword)
Password used to open the signature private key during marshaling. |
Methods inherited from class org.apache.camel.support.ServiceSupport |
---|
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, resume, shutdown, start, stop, suspend |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String KEY_FILE_NAME
public static final String ENCRYPTION_KEY_RING
public static final String KEY_PASSWORD
public static final String SIGNATURE_KEY_FILE_NAME
public static final String SIGNATURE_KEY_RING
public static final String SIGNATURE_KEY_PASSWORD
Constructor Detail |
---|
public PGPDataFormat()
Method Detail |
---|
protected String findKeyFileName(org.apache.camel.Exchange exchange)
protected byte[] findEncryptionKeyRing(org.apache.camel.Exchange exchange)
protected String findKeyPassword(org.apache.camel.Exchange exchange)
protected String findSignatureKeyFileName(org.apache.camel.Exchange exchange)
protected byte[] findSignatureKeyRing(org.apache.camel.Exchange exchange)
protected String findSignatureKeyPassword(org.apache.camel.Exchange exchange)
public List<PGPSecretKeyAndPrivateKeyAndUserId> determineSecretKeysWithPrivateKeyAndUserId(org.apache.camel.Exchange exchange, String sigKeyFileName, List<String> sigKeyUserids, String sigKeyPassword, byte[] sigKeyRing) throws IOException, org.bouncycastle.openpgp.PGPException, NoSuchProviderException
IOException
org.bouncycastle.openpgp.PGPException
NoSuchProviderException
public Map<String,String> determineSignatureKeyUserId2Password(List<String> sigKeyUserids, String sigKeyPassword)
public void setKeyFileName(String keyFileName)
setEncryptionKeyRing(byte[])
.
public String getKeyFileName()
public void setPassword(String password)
setPassphraseAccessor(PGPPassphraseAccessor)
.
public String getPassword()
public void setSignatureKeyFileName(String signatureKeyFileName)
public String getSignatureKeyFileName()
public void setSignaturePassword(String signaturePassword)
public String getSignaturePassword()
public byte[] getEncryptionKeyRing()
public void setEncryptionKeyRing(byte[] encryptionKeyRing)
setKeyFileName(String)
.
public byte[] getSignatureKeyRing()
public void setSignatureKeyRing(byte[] signatureKeyRing)
setSignatureKeyFileName(String)
.
public PGPPassphraseAccessor getPassphraseAccessor()
public void setPassphraseAccessor(PGPPassphraseAccessor passphraseAccessor)
SIGNATURE_KEY_PASSWORD
or KEY_PASSWORD
then we
try to get the password from the passphrase accessor. This is especially
useful in the decrypt case, where we chose the private key according to
the key Id stored in the encrypted data.
public List<org.bouncycastle.openpgp.PGPPublicKey> getEncryptionKeys(org.apache.camel.Exchange exchange, List<String> useridParts) throws Exception
PGPPublicKeyAccessor
getEncryptionKeys
in interface PGPPublicKeyAccessor
exchange
- exchange, can be null
useridParts
- parts of User IDs, must not be null
null
Exception
public List<PGPSecretKeyAndPrivateKeyAndUserId> getSignerKeys(org.apache.camel.Exchange exchange, List<String> useridParts) throws Exception
PGPSecretKeyAccessor
getSignerKeys
in interface PGPSecretKeyAccessor
exchange
- exchange, can be null
useridParts
- parts of User IDs, can be null
or empty, then an
empty list must be returned
null
, can be empty
Exception
public org.bouncycastle.openpgp.PGPPrivateKey getPrivateKey(org.apache.camel.Exchange exchange, long keyId) throws Exception
PGPSecretKeyAccessor
getPrivateKey
in interface PGPSecretKeyAccessor
exchange
- exchange, can be null
keyId
- key ID
null
if the key cannot be found
Exception
public org.bouncycastle.openpgp.PGPPublicKey getPublicKey(org.apache.camel.Exchange exchange, long keyId, List<String> userIdParts) throws Exception
PGPPublicKeyAccessor
getPublicKey
in interface PGPPublicKeyAccessor
exchange
- exchangekeyId
- key IDuserIdParts
- parts of User IDs, must not be null
, but can be
empty
null
if the key cannot be found
Exception
public void setPublicKeyAccessor(PGPPublicKeyAccessor publicKeyAccessor)
setPublicKeyAccessor
in class PGPKeyAccessDataFormat
public void setSecretKeyAccessor(PGPSecretKeyAccessor secretKeyAccessor)
setSecretKeyAccessor
in class PGPKeyAccessDataFormat
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |