public interface Output
An object implementing this interface is always returned by a
SecurityService
instance when any of the encrypt, sign or
verify methods.
Ultimately the object implementing this interface will be reponsible for reading from and writing to an encrypted payload. This payload could be in any particular format e.g. something like S/MIME or EDI-INT with boundaries and such.
The type of output that is represented can be determined using the
getType()
method.
Three types of message are defined
For payloads that are both encrypted and signed, the operations
if (Output.getType() & Output.ENCRYPTED) > 0)
if (Output.getType() & Output.SIGNED) > 0)
Alternatively, the isEncrypted(), isSigned(), isPlain()
methods can be used.
Modifier and Type | Field and Description |
---|---|
static int |
ENCRYPTED
encrypted output
|
static int |
PLAIN
decrypted output
|
static int |
SIGNED
signed output
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAsString()
Return the internal message, either encrypted or decrypted.
|
java.lang.String |
getAsString(java.lang.String enc)
Return the internal message, either encrypted or decrypted.
|
byte[] |
getBytes()
Return the internal message, either encrypted or decrypted.
|
int |
getType()
Return the type of message this is, encrypted, plain, signed.
|
boolean |
isEncrypted()
isEncrypted.
|
boolean |
isPlain()
isPlain.
|
boolean |
isSigned()
isSigned.
|
static final int ENCRYPTED
static final int PLAIN
static final int SIGNED
java.lang.String getAsString() throws AdaptrisSecurityException
This will return a String (using the platform default encoding) in the appropriate format, ready for writing to an OutputStream or further processing
AdaptrisSecurityException
- for any errorjava.lang.String getAsString(java.lang.String enc) throws AdaptrisSecurityException, java.io.UnsupportedEncodingException
This will return a String (using the specified encoding) in the appropriate format, ready for writing to an OutputStream or further processing
enc
- the encodingAdaptrisSecurityException
- wrapping any other underlying exceptionjava.io.UnsupportedEncodingException
- if the encoding type is not supported.byte[] getBytes() throws AdaptrisSecurityException
This returns the raw bytes in the appropriate format, ready for writing to an OutputStream or further processing
AdaptrisSecurityException
- for any errorint getType()
boolean isEncrypted()
boolean isPlain()
boolean isSigned()