public class SignedAndEnvelopedDataDemo extends java.lang.Object
All keys and certificates are read from a keystore created by the SetupCMSKeyStore program.
Constructor and Description |
---|
SignedAndEnvelopedDataDemo()
Setup the demo certificate chains.
|
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] argv)
Main method.
|
void |
start()
Starts the test.
|
void |
testSignedAndEnvelopedData(byte[] message)
Uses the non-stream based SignedData and EnvelopedData implementations
(
SignedData , EnvelopedData to
sign and envelope the given message, encode the CMS object, decodes it
again, removes the envlope and verifies the signature. |
void |
testSignedAndEnvelopedDataStream(byte[] message)
Uses the stream based SignedData and EnvelopedData implementations
(
SignedDataStream , EnvelopedDataStream to
sign and envelope the given message, encode the CMS object, decodes it
again, removes the envlope and verifies the signature. |
public SignedAndEnvelopedDataDemo() throws java.io.IOException
java.io.IOException
- if an file read error occurspublic void testSignedAndEnvelopedDataStream(byte[] message) throws java.lang.Exception
SignedDataStream
, EnvelopedDataStream
to
sign and envelope the given message, encode the CMS object, decodes it
again, removes the envlope and verifies the signature.message
- the message to be signed and envelopedjava.lang.Exception
- if an error occurspublic void testSignedAndEnvelopedData(byte[] message) throws java.lang.Exception
SignedData
, EnvelopedData
to
sign and envelope the given message, encode the CMS object, decodes it
again, removes the envlope and verifies the signature.message
- the message to be signed and envelopedjava.lang.Exception
- if an error occurspublic void start()
public static void main(java.lang.String[] argv) throws java.lang.Exception
java.io.IOException
- if an I/O error occurs when reading required keys
and certificates from filesjava.lang.Exception