public class CMSStreamDemo extends java.lang.Object
SMimeSigned
,
SMimeEncrypted
Constructor and Description |
---|
CMSStreamDemo()
Empty default constructor.
|
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] argv)
The main method.
|
void |
setupCertificates()
Reads the required keys and certificates from the demo keystore.
|
void |
start()
Starts the demo.
|
void |
testSMimeAuthEncrypted(iaik.asn1.structures.AlgorithmID contentEA,
iaik.asn1.structures.AlgorithmID keyWrapAlg,
int keyLength,
int recipientIndex)
Uses class
SMimeAuthEncrypted to
authenticated encrypt some data, encode it,
and finally parses the encoding to decrypt and recover the original content. |
void |
testSMimeEncrypted(iaik.asn1.structures.AlgorithmID contentEA,
iaik.asn1.structures.AlgorithmID keyWrapAlg,
int keyLength,
int recipientIndex)
Uses class
SMimeEncrypted to encrypt some data, encode it,
and finally parses the encoding to decrypt and recover the original content. |
void |
testSMimeSigned(int mode)
Uses class
SMimeSigned to sign some data, encode it,
and finally parses the encoding to verify the signature. |
void |
testSMimeSignedAndAuthEncrypted(iaik.asn1.structures.AlgorithmID contentEA,
iaik.asn1.structures.AlgorithmID keyWrapAlg,
int keyLength,
int recipientIndex)
Uses class
SMimeSigned and class SMimeAuthEncrypted
to sign and authenticated encrypt some data, encode it, and finally parses the encoding to decrypt and recover the original content
and verify the signature. |
void |
testSMimeSignedAndEncrypted(iaik.asn1.structures.AlgorithmID contentEA,
iaik.asn1.structures.AlgorithmID keyWrapAlg,
int keyLength,
int recipientIndex)
Uses class
SMimeSigned and class SMimeEncrypted
to sign and encrypt some data, encode it, and finally parses the encoding to decrypt and recover the original content
and verify the signature. |
public CMSStreamDemo()
public void setupCertificates() throws java.lang.Exception
java.lang.Exception
- if some error occurs when reading from the keystorepublic void testSMimeEncrypted(iaik.asn1.structures.AlgorithmID contentEA, iaik.asn1.structures.AlgorithmID keyWrapAlg, int keyLength, int recipientIndex) throws java.lang.Exception
SMimeEncrypted
to encrypt some data, encode it,
and finally parses the encoding to decrypt and recover the original content.contentEA
- the content encryption algorithm to be usedkeyWrapAlg
- the key wrap algorithm to be used for encrypting the temporary content encryption keykeyLength
- the length of the content encryption key to be created and usedrecipientIndex
- the index into the recipientInfos field indicating for which recipient the message
shall be decryptedjava.lang.Exception
- if some error occurspublic void testSMimeSigned(int mode) throws java.lang.Exception
SMimeSigned
to sign some data, encode it,
and finally parses the encoding to verify the signature.mode
- either implicit
or
explicit
to indicate
whether the content shall be included in the signature or
transmitted out-of-bandjava.lang.Exception
- if some error occurspublic void testSMimeAuthEncrypted(iaik.asn1.structures.AlgorithmID contentEA, iaik.asn1.structures.AlgorithmID keyWrapAlg, int keyLength, int recipientIndex) throws java.lang.Exception
SMimeAuthEncrypted
to
authenticated encrypt some data, encode it,
and finally parses the encoding to decrypt and recover the original content.contentEA
- the content-authenticated encryption algorithm to be usedkeyWrapAlg
- the key wrap algorithm to be used for encrypting the temporary content encryption keykeyLength
- the length of the content encryption key to be created and usedrecipientIndex
- the index into the recipientInfos field indicating for which recipient the message
shall be decryptedjava.lang.Exception
- if some error occurspublic void testSMimeSignedAndEncrypted(iaik.asn1.structures.AlgorithmID contentEA, iaik.asn1.structures.AlgorithmID keyWrapAlg, int keyLength, int recipientIndex) throws java.lang.Exception
SMimeSigned
and class SMimeEncrypted
to sign and encrypt some data, encode it, and finally parses the encoding to decrypt and recover the original content
and verify the signature.contentEA
- the content encryption algorithm to be usedkeyWrapAlg
- the key wrap algorithm to be used for encrypting the temporary content encryption keykeyLength
- the length of the content encryption key to be created and usedrecipientIndex
- the index into the recipientInfos field indicating for which recipient the message
shall be decryptedjava.lang.Exception
- if some error occurspublic void testSMimeSignedAndAuthEncrypted(iaik.asn1.structures.AlgorithmID contentEA, iaik.asn1.structures.AlgorithmID keyWrapAlg, int keyLength, int recipientIndex) throws java.lang.Exception
SMimeSigned
and class SMimeAuthEncrypted
to sign and authenticated encrypt some data, encode it, and finally parses the encoding to decrypt and recover the original content
and verify the signature.contentEA
- the content-authenticated encryption algorithm to be usedkeyWrapAlg
- the key wrap algorithm to be used for encrypting the temporary content encryption keykeyLength
- the length of the content encryption key to be created and usedrecipientIndex
- the index into the recipientInfos field indicating for which recipient the message
shall be decryptedjava.lang.Exception
- if some error occurspublic void start()
public static void main(java.lang.String[] argv) throws java.io.IOException
java.io.IOException