|
IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdemo.cms.authEnvelopedData.AuthEnvelopedDataOutputStreamDemo
public class AuthEnvelopedDataOutputStreamDemo
Demonstrates the usage of class AuthEnvelopedDataOutputStream
and
for authenticated encrypting data using the CMS type AuthEnvelopedData
according to RFC 5083.
This demo uses the AES-CCM and AES-GCM authenticated encryption algorithms
as specified by RFC 5084
and the ChaCha20-Poly1305 authenticated encryption algorithm
as specified by RFC 8103.
The demo creates an AuthEnvelopedData object and subsequently shows several
ways that may be used for decrypting the content and verifying the message
authentication code for some particular recipient.
Since AES-CCM and AES-GCM are not implemented by IAIK-JCE versions prior 3.17, this demo
at least may require IAIK-JCE 3.17 as cryptographic service provider.
ChaCha20-Poly1305 for CMS requires IAIK-JCE version 5.62 or later.
Keys and certificates are retrieved from the demo KeyStore ("cms.keystore")
which has to be located in your current working directory and may be
created by running the SetupCMSKeyStore
program.
Constructor Summary | |
---|---|
AuthEnvelopedDataOutputStreamDemo()
Setup the demo certificate chains. |
Method Summary | |
---|---|
byte[] |
createAuthEnvelopedData(byte[] message,
iaik.asn1.structures.AlgorithmID contentAuthEncAlg)
Creates a CMS AuthEnvelopedData and wraps it into a ContentInfo. |
byte[] |
getAuthEnvelopedDataStream(byte[] encoding,
java.security.PrivateKey privateKey,
int recipientInfoIndex)
Decrypts the encrypted content of the given AuthEnvelopedData object and verifies the message authentication code for the specified recipient. |
static void |
main(java.lang.String[] argv)
Main method. |
void |
start()
Starts the test. |
void |
start(iaik.asn1.structures.AlgorithmID contentAuthEncAlg)
Starts the test for the given content-authenticated encryption algorithm. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AuthEnvelopedDataOutputStreamDemo() throws java.io.IOException
java.io.IOException
- if an file read error occursMethod Detail |
---|
public byte[] createAuthEnvelopedData(byte[] message, iaik.asn1.structures.AlgorithmID contentAuthEncAlg) throws iaik.cms.CMSException, java.io.IOException
AuthEnvelopedData
and wraps it into a ContentInfo.
message
- the message to be enveloped, as byte representationcontentAuthEncAlg
- the id of the content-authenticated encryption algorithm
iaik.cms.CMSException
- if the AuthEnvelopedData
object cannot
be created
java.io.IOException
- if an I/O error occurspublic byte[] getAuthEnvelopedDataStream(byte[] encoding, java.security.PrivateKey privateKey, int recipientInfoIndex) throws iaik.cms.CMSException, java.io.IOException
encoding
- the encoded AuthEnvelopedData object, wrapped in a ContentInfoprivateKey
- the private key to decrypt the messagerecipientInfoIndex
- the index into the RecipientInfo
array
to which the specified private key belongs
iaik.cms.CMSException
- if the message cannot be recovered
java.io.IOException
- if an I/O error occurspublic void start()
public void start(iaik.asn1.structures.AlgorithmID contentAuthEncAlg)
contentAuthEncAlg
- the id of the content-authenticated encryption algorithmpublic static void main(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception
- if an some error occurs
|
IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
![]() |
v6.1 (c) 2002 IAIK, (c) 2003 - 2025 SIC |
![]() |