@Dataformat(value="pgp") public class PGPDataFormat extends PGPKeyAccessDataFormat implements PGPPublicKeyAccessor, PGPSecretKeyAccessor
PGPDataFormat
uses the bouncy castle libraries to
enable encryption and decryption in the PGP format.
See also PGPKeyAccessDataFormat
.
Modifier and Type | Field and Description |
---|---|
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 |
COMPRESSION_ALGORITHM, ENCRYPTION_ALGORITHM, KEY_USERID, KEY_USERIDS, NUMBER_OF_ENCRYPTION_KEYS, NUMBER_OF_SIGNING_KEYS, SIGNATURE_HASH_ALGORITHM, SIGNATURE_KEY_USERID, SIGNATURE_KEY_USERIDS, SIGNATURE_VERIFICATION_OPTION_IGNORE, SIGNATURE_VERIFICATION_OPTION_NO_SIGNATURE_ALLOWED, SIGNATURE_VERIFICATION_OPTION_OPTIONAL, SIGNATURE_VERIFICATION_OPTION_REQUIRED
Constructor and Description |
---|
PGPDataFormat() |
Modifier and Type | Method and Description |
---|---|
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.
|
createSignatureGenerator, determineEncryptionUserIds, determineSignaturenUserIds, doStart, doStop, findAlgorithm, findCompressionAlgorithm, findFileName, findHashAlgorithm, findKeyUserid, findKeyUserids, findSignatureKeyUserid, findSignatureKeyUserids, getAlgorithm, getArmored, getCompressionAlgorithm, getDataFormatName, getFileName, getHashAlgorithm, getIntegrity, getKeyUserid, getKeyUserids, getProvider, getPublicKeyAccessor, getSecretKeyAccessor, getSignature, getSignatureKeyUserid, getSignatureKeyUserids, getSignatureVerificationOption, getSignatureWithKeyId, isWithCompressedDataPacket, marshal, setAlgorithm, setArmored, setCompressionAlgorithm, setFileName, setHashAlgorithm, setIntegrity, setKeyUserid, setKeyUserids, setProvider, setSignatureKeyUserid, setSignatureKeyUserids, setSignatureVerificationOption, setWithCompressedDataPacket, unmarshal
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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
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
IOException
org.bouncycastle.openpgp.PGPException
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 returnednull
, can be emptyException
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 IDnull
if the key cannot be foundException
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 emptynull
if the key cannot be foundException
public void setPublicKeyAccessor(PGPPublicKeyAccessor publicKeyAccessor)
setPublicKeyAccessor
in class PGPKeyAccessDataFormat
public void setSecretKeyAccessor(PGPSecretKeyAccessor secretKeyAccessor)
setSecretKeyAccessor
in class PGPKeyAccessDataFormat
Apache Camel