@ComponentProfile(summary="Verify sign data using a PGP/GPG public key", tag="pgp,gpg,sign,signature,verify,public key", since="3.9.2") public class PGPVerifyService extends ServiceImp
<pgp-verify>
<unique-id>jovial-elion</unique-id>
<public-key class="constant-data-input-parameter">
<value>-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBF2ckxABCAC5Kfu39ky3OIXkxwWOJx70G2dLRYvDMHXf3ZraUPNRMIhh3ZGx
-----END PGP PUBLIC KEY BLOCK-----</value>
</public-key>
<signed-message class="stream-payload-input-parameter"/> <!-- signed message (without signature, as it's detached) -->
<signature class="metadata-stream-input-parameter"> <!-- detached signature comes into message metadata -->
<metadata-key>signature</metadata-key>
</signature>
<original-message class="string-payload-data-output-parameter"/> <!-- optional original message, without signature -->
</pgp-verify>
In the adapter configuration file this class is aliased as pgp-verify which is the preferred alternative to the fully qualified classname when building your configuration.
CONFIRMATION_ID_KEY
Constructor and Description |
---|
PGPVerifyService() |
Modifier and Type | Method and Description |
---|---|
protected void |
closeService()
.
|
void |
doService(AdaptrisMessage message)
.
|
protected java.io.InputStream |
extractStream(AdaptrisMessage message,
DataInputParameter parameter,
java.lang.String warning) |
protected java.lang.String |
extractString(AdaptrisMessage message,
DataInputParameter parameter,
java.lang.String warning) |
protected static java.io.InputStream |
getDecoderStream(java.io.InputStream in)
Obtains a stream that can be used to read PGP data from the provided stream.
|
protected static int |
getLengthWithoutSeparatorOrTrailingWhitespace(byte[] line) |
protected static int |
getLengthWithoutWhiteSpace(byte[] line) |
protected static byte[] |
getLineSeparator() |
DataOutputParameter |
getOriginalMessage()
Get the unsigned message.
|
DataInputParameter |
getPublicKey()
Get the private key for decryption.
|
DataInputParameter |
getSignature()
Get the signature to verify.
|
DataInputParameter |
getSignedMessage()
Get the signed message to verify.
|
protected void |
initService()
.
|
protected void |
insertStream(AdaptrisMessage message,
DataOutputParameter parameter,
java.io.ByteArrayOutputStream value) |
void |
prepare()
.
|
protected static void |
processLine(java.io.OutputStream aOut,
org.bouncycastle.openpgp.PGPSignatureGenerator sGen,
byte[] line) |
protected static void |
processLine(org.bouncycastle.openpgp.PGPSignature sig,
byte[] line) |
protected static int |
readInputLine(java.io.ByteArrayOutputStream bOut,
java.io.InputStream fIn) |
protected static int |
readInputLine(java.io.ByteArrayOutputStream bOut,
int lookAhead,
java.io.InputStream fIn) |
void |
setOriginalMessage(DataOutputParameter message)
Set the unsigned message.
|
void |
setPublicKey(DataInputParameter publicKey)
Set the private key for decryption.
|
void |
setSignature(DataInputParameter signature)
Set the signature to verify.
|
void |
setSignedMessage(DataInputParameter signedMessage)
Set the signed message to verify.
|
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setUniqueId, start, stop
public void doService(AdaptrisMessage message) throws ServiceException
ServiceException
public void setPublicKey(DataInputParameter publicKey)
publicKey
- The private key.public DataInputParameter getPublicKey()
public void setSignedMessage(DataInputParameter signedMessage)
signedMessage
- The signed message.public DataInputParameter getSignedMessage()
public void setSignature(DataInputParameter signature)
signature
- The signature.public DataInputParameter getSignature()
public void setOriginalMessage(DataOutputParameter message)
message
- The message.public DataOutputParameter getOriginalMessage()
protected void initService()
initService
in class ServiceImp
protected void closeService()
closeService
in class ServiceImp
public void prepare()
protected java.io.InputStream extractStream(AdaptrisMessage message, DataInputParameter parameter, java.lang.String warning) throws java.lang.Exception
java.lang.Exception
protected java.lang.String extractString(AdaptrisMessage message, DataInputParameter parameter, java.lang.String warning) throws java.lang.Exception
java.lang.Exception
protected void insertStream(AdaptrisMessage message, DataOutputParameter parameter, java.io.ByteArrayOutputStream value) throws java.lang.Exception
java.lang.Exception
protected static java.io.InputStream getDecoderStream(java.io.InputStream in) throws java.io.IOException
If the initial bytes of the underlying stream are binary PGP encodings, then the stream will
be returned directly, otherwise an ArmoredInputStream
is used to wrap the provided
stream and remove ASCII-Armored encoding.
in
- the stream to be checked and possibly wrapped.java.io.IOException
- if an error occurs reading the stream, or initialising the
ArmoredInputStream
.protected static void processLine(java.io.OutputStream aOut, org.bouncycastle.openpgp.PGPSignatureGenerator sGen, byte[] line) throws java.security.SignatureException, java.io.IOException
java.security.SignatureException
java.io.IOException
protected static void processLine(org.bouncycastle.openpgp.PGPSignature sig, byte[] line) throws java.security.SignatureException, java.io.IOException
java.security.SignatureException
java.io.IOException
protected static int getLengthWithoutWhiteSpace(byte[] line)
protected static int getLengthWithoutSeparatorOrTrailingWhitespace(byte[] line)
protected static byte[] getLineSeparator()
protected static int readInputLine(java.io.ByteArrayOutputStream bOut, java.io.InputStream fIn) throws java.io.IOException
java.io.IOException
protected static int readInputLine(java.io.ByteArrayOutputStream bOut, int lookAhead, java.io.InputStream fIn) throws java.io.IOException
java.io.IOException