|
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.smime.ess.MLADemo
public class MLADemo
A ESS mailing list agent (MLA) demo.
Demonstrates the usage of the MLA
utility by
means of the examples given in RFC2634,
section 4.2.1:
4.2.1 Examples of Rule Processing The following examples help explain the rules above: 1) A message (S1(Original Content)) (where S = SignedData) is sent to the MLA in which the signedData layer does not include an MLExpansionHistory attribute. The MLA verifies and fully processes the signedAttributes in S1. The MLA decides that there is not an original, received "outer" signedData layer since it finds the original content, but never finds an envelopedData and never finds an mlExpansionHistory attribute. The MLA calculates a new signedData layer, S2, resulting in the following message sent to the ML recipients: (S2(S1(Original Content))). The MLA includes an mlExpansionHistory attribute in S2. 2) A message (S3(S2(S1(Original Content)))) is sent to the MLA in which none of the signedData layers includes an MLExpansionHistory attribute. The MLA verifies and fully processes the signedAttributes in S3, S2 and S1. The MLA decides that there is not an original, received "outer" signedData layer since it finds the original content, but never finds an envelopedData and never finds an mlExpansionHistory attribute. The MLA calculates a new signedData layer, S4, resulting in the following message sent to the ML recipients: (S4(S3(S2(S1(Original Content))))). The MLA includes an mlExpansionHistory attribute in S4. 3) A message (E1(S1(Original Content))) (where E = envelopedData) is sent to the MLA in which S1 does not include an MLExpansionHistory attribute. The MLA decides that there is not an original, received "outer" signedData layer since it finds the E1 as the outer layer. The MLA expands the recipientInformation in E1. The MLA calculates a new signedData layer, S2, resulting in the following message sent to the ML recipients: (S2(E1(S1(Original Content)))). The MLA includes an mlExpansionHistory attribute in S2. 4) A message (S2(E1(S1(Original Content)))) is sent to the MLA in which S2 includes an MLExpansionHistory attribute. The MLA verifies the signature and fully processes the signedAttributes in S2. The MLA finds the mlExpansionHistory attribute in S2, so it decides that S2 is the "outer" signedData. The MLA remembers the signedAttributes included in S2 for later inclusion in the new outer signedData that it applies to the message. The MLA strips off S2. The MLA then expands the recipientInformation in E1 (this invalidates the signature in S2 which is why it was stripped). The nMLA calculates a new signedData layer, S3, resulting in the following message sent to the ML recipients: (S3(E1(S1(Original Content)))). The MLA includes in S3 the attributes from S2 (unless it specifically replaces an attribute value) including an updated mlExpansionHistory attribute. 5) A message (S3(S2(E1(S1(Original Content))))) is sent to the MLA in which none of the signedData layers include an MLExpansionHistory attribute. The MLA verifies the signature and fully processes the signedAttributes in S3 and S2. When the MLA encounters E1, then it decides that S2 is the "outer" signedData since S2 encapsulates E1. The MLA remembers the signedAttributes included in S2 for later inclusion in the new outer signedData that it applies to the message. The MLA strips off S3 and S2. The MLA then expands the recipientInformation in E1 (this invalidates the signatures in S3 and S2 which is why they were stripped). The MLA calculates a new signedData layer, S4, resulting in the following message sent to the ML recipients: (S4(E1(S1(Original Content)))). The MLA includes in S4 the attributes from S2 (unless it specifically replaces an attribute value) and includes a new mlExpansionHistory attribute. 6) A message (S3(S2(E1(S1(Original Content))))) is sent to the MLA in which S3 includes an MLExpansionHistory attribute. In this case, the MLA verifies the signature and fully processes the signedAttributes in S3. The MLA finds the mlExpansionHistory in S3, so it decides that S3 is the "outer" signedData. The MLA remembers the signedAttributes included in S3 for later inclusion in the new outer signedData that it applies to the message. The MLA keeps on parsing encapsulated layers because it must determine if there are any eSSSecurityLabel attributes contained within. The MLA verifies the signature and fully processes the signedAttributes in S2. When the MLA encounters E1, then it strips off S3 and S2. The MLA then expands the recipientInformation in E1 (this invalidates the signatures in S3 and S2 which is why they were stripped). The MLA calculates a new signedData layer, S4, resulting in the following message sent to the ML recipients: (S4(E1(S1(Original Content)))). The MLA includes in S4 the attributes from S3 (unless it specifically replaces an attribute value) including an updated mlExpansionHistory attribute.To run this demo the following packages are required:
iaik_cms.jar
iaik_jce(_full).jar
(IAIK-JCE Core Crypto Library).
mail.jar
(JavaMail API).
activation.jar
(Java Activation Framework; required for JDK versions < 1.6).
MLExpansionHistory
,
MLData
,
MLReceiptPolicy
,
MLA
Constructor Summary | |
---|---|
MLADemo()
Empty default constructor. |
Method Summary | |
---|---|
iaik.smime.EncryptedContent |
create_E1_S1_O(java.lang.Object content,
java.lang.String contentType,
boolean implicitS1,
iaik.x509.X509Certificate[] signerCertificatesS1,
java.security.PrivateKey signerPrivateKeyS1,
iaik.asn1.structures.AlgorithmID digestAlgS1,
iaik.asn1.structures.AlgorithmID signatureAlgS1,
iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS1,
iaik.x509.X509Certificate recipientCertificate,
iaik.asn1.structures.AlgorithmID cekEncrAlg,
iaik.asn1.structures.AlgorithmID contentEncrAlg,
int cekLength)
Encrypts and signs the given content. |
iaik.smime.SignedContent |
create_S1_O(java.lang.Object content,
java.lang.String contentType,
boolean implicitS1,
iaik.x509.X509Certificate[] signerCertificatesS1,
java.security.PrivateKey signerPrivateKeyS1,
iaik.asn1.structures.AlgorithmID digestAlgS1,
iaik.asn1.structures.AlgorithmID signatureAlgS1,
iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS1)
Signs the given content. |
iaik.smime.SignedContent |
create_S2_E1_S1_0(java.lang.Object content,
java.lang.String contentType,
boolean implicitS1,
iaik.x509.X509Certificate[] signerCertificatesS1,
java.security.PrivateKey signerPrivateKeyS1,
iaik.asn1.structures.AlgorithmID digestAlgS1,
iaik.asn1.structures.AlgorithmID signatureAlgS1,
iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS1,
iaik.x509.X509Certificate recipientCertificate,
iaik.asn1.structures.AlgorithmID cekEncrAlg,
iaik.asn1.structures.AlgorithmID contentEncrAlg,
int cekLength,
boolean implicitS2,
iaik.x509.X509Certificate[] signerCertificatesS2,
java.security.PrivateKey signerPrivateKeyS2,
iaik.asn1.structures.AlgorithmID digestAlgS2,
iaik.asn1.structures.AlgorithmID signatureAlgS2,
iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS2)
Signs and encrypts and signs the given content. |
iaik.smime.SignedContent |
create_S3_S2_E1_S1_0(java.lang.Object content,
java.lang.String contentType,
boolean implicitS1,
iaik.x509.X509Certificate[] signerCertificatesS1,
java.security.PrivateKey signerPrivateKeyS1,
iaik.asn1.structures.AlgorithmID digestAlgS1,
iaik.asn1.structures.AlgorithmID signatureAlgS1,
iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS1,
iaik.x509.X509Certificate recipientCertificate,
iaik.asn1.structures.AlgorithmID cekEncrAlg,
iaik.asn1.structures.AlgorithmID contentEncrAlg,
int cekLength,
boolean implicitS2,
iaik.x509.X509Certificate[] signerCertificatesS2,
java.security.PrivateKey signerPrivateKeyS2,
iaik.asn1.structures.AlgorithmID digestAlgS2,
iaik.asn1.structures.AlgorithmID signatureAlgS2,
iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS2,
boolean implicitS3,
iaik.x509.X509Certificate[] signerCertificatesS3,
java.security.PrivateKey signerPrivateKeyS3,
iaik.asn1.structures.AlgorithmID digestAlgS3,
iaik.asn1.structures.AlgorithmID signatureAlgS3,
iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS3)
Signs and encrypts and double-signs the given content. |
iaik.smime.SignedContent |
create_S3_S2_S1_O(java.lang.Object content,
java.lang.String contentType,
boolean implicitS1,
iaik.x509.X509Certificate[] signerCertificatesS1,
java.security.PrivateKey signerPrivateKeyS1,
iaik.asn1.structures.AlgorithmID digestAlgS1,
iaik.asn1.structures.AlgorithmID signatureAlgS1,
iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS1,
boolean implicitS2,
iaik.x509.X509Certificate[] signerCertificatesS2,
java.security.PrivateKey signerPrivateKeyS2,
iaik.asn1.structures.AlgorithmID digestAlgS2,
iaik.asn1.structures.AlgorithmID signatureAlgS2,
iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS2,
boolean implicitS3,
iaik.x509.X509Certificate[] signerCertificatesS3,
java.security.PrivateKey signerPrivateKeyS3,
iaik.asn1.structures.AlgorithmID digestAlgS3,
iaik.asn1.structures.AlgorithmID signatureAlgS3,
iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS3)
Triple-signs the given content. |
iaik.smime.EncryptedContent |
createEncryptedContent(java.lang.Object content,
java.lang.String contentType,
iaik.x509.X509Certificate recipientCertificate,
iaik.asn1.structures.AlgorithmID cekEncrAlg,
iaik.asn1.structures.AlgorithmID contentEncrAlg,
int cekLength)
Creates an EncryptedContent. |
javax.mail.Message |
createMessage(javax.mail.Session session,
java.lang.String from,
java.lang.String to)
Creates a new MimeMessage without content and sets the From:, To:, and Date: headers. |
static iaik.smime.ess.MLExpansionHistory |
createMLExpansionHistory(iaik.x509.X509Certificate mlaCertificate,
java.util.Date expansionTime,
iaik.smime.ess.MLReceiptPolicy mlReceiptPolicy)
Creates a MLExpansionHistory containing only one MLData for the given MLA with given expansion time and MLReceiptPolicy. |
iaik.smime.SignedContent |
createSignedContent(java.lang.Object content,
java.lang.String contentType,
boolean implicit,
iaik.x509.X509Certificate[] signerCertificates,
java.security.PrivateKey signerPrivateKey,
iaik.asn1.structures.AlgorithmID digestAlg,
iaik.asn1.structures.AlgorithmID signatureAlg,
iaik.smime.ess.MLExpansionHistory mlExpansionHistory)
Creates a SignedContent. |
javax.activation.DataHandler |
decrypt(iaik.smime.EncryptedContent ec,
java.security.PrivateKey privateKey,
iaik.x509.X509Certificate certificate)
Decrypts the encrypted content with the given key of the identified recipient. |
void |
dumpContent(javax.activation.DataHandler dh)
Dumps the content of the original multipart message. |
static void |
main(java.lang.String[] argv)
Main method. |
iaik.smime.SignedContent |
processMessageForMLA(javax.mail.Message msg,
boolean implicit,
java.lang.String debugID)
|
static void |
readMLExpansionHistory(iaik.smime.SignedContent signedContent,
int count)
Reads the MLExpansionHistory attribute from the given signed data and dumps the included MLData structures. |
void |
start()
Runs the demo samples. |
void |
test_E1_S1_O(javax.mail.Session session,
javax.mail.Multipart mp,
byte[] dsBytes,
boolean implicit)
Tests the MLA behaviour for a encrypted and signed signed message according to sample 4.2.1,3) of RFC2634: A message (E1(S1(Original Content))) (where E = envelopedData) is sent to the MLA in which S1 does not include an MLExpansionHistory attribute. |
void |
test_S1_O(javax.mail.Session session,
javax.mail.Multipart mp,
byte[] dsBytes,
boolean implicit)
Tests the MLA behaviour for a simple signed message according to sample 4.2.1,1) of RFC2634: A message (S1(Original Content)) (where S = SignedData) is sent to the MLA in which the signedData layer does not include an MLExpansionHistory attribute. |
void |
test_S2_E1_S1_O(javax.mail.Session session,
javax.mail.Multipart mp,
byte[] dsBytes,
boolean implicit)
Tests the MLA behaviour for signed encrypted and signed signed message according to sample 4.2.1,4) of RFC2634: A message (S2(E1(S1(Original Content)))) is sent to the MLA in which S2 includes an MLExpansionHistory attribute. |
void |
test_S3_S2_E1_S1_O(javax.mail.Session session,
javax.mail.Multipart mp,
byte[] dsBytes,
boolean implicit,
boolean includeMLExpansionHistoryInS3)
Tests the MLA behaviour for double signed encrypted and signed signed message according to sample 4.2.1,5) of RFC2634: A message (S3(S2(E1(S1(Original Content))))) is sent to the MLA in which none of the signedData layers include an MLExpansionHistory attribute. |
void |
test_S3_S2_S1_O(javax.mail.Session session,
javax.mail.Multipart mp,
byte[] dsBytes,
boolean implicit)
Tests the MLA behaviour for a triple signed message according to sample 4.2.1,2) of RFC2634: A message (S3(S2(S1(Original Content)))) is sent to the MLA in which none of the signedData layers includes an MLExpansionHistory attribute. |
javax.activation.DataHandler |
verify(iaik.smime.SignedContent sc,
iaik.x509.X509Certificate signerCert)
Verifies the signature of the given SignedContent and returns the inherent content data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MLADemo()
Method Detail |
---|
public void start()
public void test_S1_O(javax.mail.Session session, javax.mail.Multipart mp, byte[] dsBytes, boolean implicit) throws java.lang.Exception
A message (S1(Original Content)) (where S = SignedData) is sent to the MLA in which the signedData layer does not include an MLExpansionHistory attribute. The MLA verifies and fully processes the signedAttributes in S1. The MLA decides that there is not an original, received "outer" signedData layer since it finds the original content, but never finds an envelopedData and never finds an mlExpansionHistory attribute. The MLA calculates a new signedData layer, S2, resulting in the following message sent to the ML recipients: (S2(S1(Original Content))). The MLA includes an mlExpansionHistory attribute in S2.
session
- the current mail sessionmp
- the multipart contentdsBytes
- the original content dataSorce bytes for comparisonimplicit
- whether implicit (content included) or explicit signing shall be used
java.lang.Exception
- if an error coourspublic void test_S3_S2_S1_O(javax.mail.Session session, javax.mail.Multipart mp, byte[] dsBytes, boolean implicit) throws java.lang.Exception
A message (S3(S2(S1(Original Content)))) is sent to the MLA in which none of the signedData layers includes an MLExpansionHistory attribute. The MLA verifies and fully processes the signedAttributes in S3, S2 and S1. The MLA decides that there is not an original, received "outer" signedData layer since it finds the original content, but never finds an envelopedData and never finds an mlExpansionHistory attribute. The MLA calculates a new signedData layer, S4, resulting in the following message sent to the ML recipients: (S4(S3(S2(S1(Original Content))))). The MLA includes an mlExpansionHistory attribute in S4.
session
- the current mail sessionmp
- the multipart contentdsBytes
- the original content dataSorce bytes for comparisonimplicit
- whether implicit (content included) or explicit signing shall be used
java.lang.Exception
- if an error coourspublic void test_E1_S1_O(javax.mail.Session session, javax.mail.Multipart mp, byte[] dsBytes, boolean implicit) throws java.lang.Exception
A message (E1(S1(Original Content))) (where E = envelopedData) is sent to the MLA in which S1 does not include an MLExpansionHistory attribute. The MLA decides that there is not an original, received "outer" signedData layer since it finds the E1 as the outer layer. The MLA expands the recipientInformation in E1. The MLA calculates a new signedData layer, S2, resulting in the following message sent to the ML recipients: (S2(E1(S1(Original Content)))). The MLA includes an mlExpansionHistory attribute in S2.
session
- the current mail sessionmp
- the multipart contentdsBytes
- the original content dataSorce bytes for comparisonimplicit
- whether implicit (content included) or explicit signing shall be used
java.lang.Exception
- if an error coourspublic void test_S2_E1_S1_O(javax.mail.Session session, javax.mail.Multipart mp, byte[] dsBytes, boolean implicit) throws java.lang.Exception
A message (S2(E1(S1(Original Content)))) is sent to the MLA in which S2 includes an MLExpansionHistory attribute. The MLA verifies the signature and fully processes the signedAttributes in S2. The MLA finds the mlExpansionHistory attribute in S2, so it decides that S2 is the "outer" signedData. The MLA remembers the signedAttributes included in S2 for later inclusion in the new outer signedData that it applies to the message. The MLA strips off S2. The MLA then expands the recipientInformation in E1 (this invalidates the signature in S2 which is why it was stripped). The nMLA calculates a new signedData layer, S3, resulting in the following message sent to the ML recipients: (S3(E1(S1(Original Content)))). The MLA includes in S3 the attributes from S2 (unless it specifically replaces an attribute value) including an updated mlExpansionHistory attribute.
session
- the current mail sessionmp
- the multipart contentdsBytes
- the original content dataSorce bytes for comparisonimplicit
- whether implicit (content included) or explicit signing shall be used
java.lang.Exception
- if an error coourspublic void test_S3_S2_E1_S1_O(javax.mail.Session session, javax.mail.Multipart mp, byte[] dsBytes, boolean implicit, boolean includeMLExpansionHistoryInS3) throws java.lang.Exception
A message (S3(S2(E1(S1(Original Content))))) is sent to the MLA in which none of the signedData layers include an MLExpansionHistory attribute. The MLA verifies the signature and fully processes the signedAttributes in S3 and S2. When the MLA encounters E1, then it decides that S2 is the "outer" signedData since S2 encapsulates E1. The MLA remembers the signedAttributes included in S2 for later inclusion in the new outer signedData that it applies to the message. The MLA strips off S3 and S2. The MLA then expands the recipientInformation in E1 (this invalidates the signatures in S3 and S2 which is why they were stripped). The MLA calculates a new signedData layer, S4, resulting in the following message sent to the ML recipients: (S4(E1(S1(Original Content)))). The MLA includes in S4 the attributes from S2 (unless it specifically replaces an attribute value) and includes a new mlExpansionHistory attribute.
session
- the current mail sessionmp
- the multipart contentdsBytes
- the original content dataSorce bytes for comparisonimplicit
- whether implicit (content included) or explicit signing shall be usedincludeMLExpansionHistoryInS3
- whether to include an MLExpansionHistory in the
the outermost signed layer (S3) of the original
message
java.lang.Exception
- if an error coourspublic javax.mail.Message createMessage(javax.mail.Session session, java.lang.String from, java.lang.String to) throws javax.mail.MessagingException
session
- the current mail sessionfrom
- the address of the sender of the messageto
- the address of the indented message recipient
javax.mail.MessagingException
- if an error occurs when setting the message headerspublic iaik.smime.SignedContent createSignedContent(java.lang.Object content, java.lang.String contentType, boolean implicit, iaik.x509.X509Certificate[] signerCertificates, java.security.PrivateKey signerPrivateKey, iaik.asn1.structures.AlgorithmID digestAlg, iaik.asn1.structures.AlgorithmID signatureAlg, iaik.smime.ess.MLExpansionHistory mlExpansionHistory) throws javax.mail.MessagingException
content
- the content to be signedcontentType
- the MIME type of the contentimplicit
- whether to create an implicit (application/pkcs7-mime) or
explicit (multipart/signed) messagesignerCertificates
- the certificate chain of the signersignerPrivateKey
- the private key to be used for signing the contentdigestAlg
- the algorithm to be used for digest calculationsignatureAlg
- the algorithm to be used for signature calculationmlExpansionHistory
- MLExpansionHistory attribute to be added; maybe null
javax.mail.MessagingException
- if a problem occurs when creating the SignedContentpublic iaik.smime.EncryptedContent createEncryptedContent(java.lang.Object content, java.lang.String contentType, iaik.x509.X509Certificate recipientCertificate, iaik.asn1.structures.AlgorithmID cekEncrAlg, iaik.asn1.structures.AlgorithmID contentEncrAlg, int cekLength) throws javax.mail.MessagingException
content
- the content to be encryptedcontentType
- the MIME type of the contentrecipientCertificate
- the encryption certificate of the recipientcekEncrAlg
- the algorithm to be used for encrypting the symmetric content encryption key
(e.g. AlgorithmID.rsaEncryption)contentEncrAlg
- the symmetric key to be used for encrypting the content, e.g. AlgorithmID.aes256_CBCcekLength
- the length of the temporary content encryption key to be generated (e.g. 256)
javax.mail.MessagingException
- if a problem occurs when creating the EncryptedContentpublic iaik.smime.SignedContent create_S1_O(java.lang.Object content, java.lang.String contentType, boolean implicitS1, iaik.x509.X509Certificate[] signerCertificatesS1, java.security.PrivateKey signerPrivateKeyS1, iaik.asn1.structures.AlgorithmID digestAlgS1, iaik.asn1.structures.AlgorithmID signatureAlgS1, iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS1) throws javax.mail.MessagingException
content
- the content to be signedcontentType
- the MIME type of the contentimplicitS1
- whether to create an implicit (application/pkcs7-mime) or
explicit (multipart/signed) messagesignerCertificatesS1
- the certificate chain of the signersignerPrivateKeyS1
- the private key to be used for signing the contentdigestAlgS1
- the algorithm to be used for digest calculationsignatureAlgS1
- the algorithm to be used for signature calculationmlExpansionHistoryS1
- MLExpansionHistory attribute to be added; maybe null
javax.mail.MessagingException
- if a problem occurs when creating the SignedContentpublic iaik.smime.SignedContent create_S3_S2_S1_O(java.lang.Object content, java.lang.String contentType, boolean implicitS1, iaik.x509.X509Certificate[] signerCertificatesS1, java.security.PrivateKey signerPrivateKeyS1, iaik.asn1.structures.AlgorithmID digestAlgS1, iaik.asn1.structures.AlgorithmID signatureAlgS1, iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS1, boolean implicitS2, iaik.x509.X509Certificate[] signerCertificatesS2, java.security.PrivateKey signerPrivateKeyS2, iaik.asn1.structures.AlgorithmID digestAlgS2, iaik.asn1.structures.AlgorithmID signatureAlgS2, iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS2, boolean implicitS3, iaik.x509.X509Certificate[] signerCertificatesS3, java.security.PrivateKey signerPrivateKeyS3, iaik.asn1.structures.AlgorithmID digestAlgS3, iaik.asn1.structures.AlgorithmID signatureAlgS3, iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS3) throws javax.mail.MessagingException
content
- the content to be signedcontentType
- the MIME type of the contentimplicitS1
- if the first signature shall be implicit (application/pkcs7-mime) or
explicit (multipart/signed)signerCertificatesS1
- the certificate chain of the first signersignerPrivateKeyS1
- the private key of the first signerdigestAlgS1
- the digest algorithm to be used for digest calculation by the innermost SignedContentsignatureAlgS1
- the algorithm to be used for signature calculation by the innermost SignedContentmlExpansionHistoryS1
- MLExpansionHistory attribute to be added to the innermost SignedContent; maybe nullimplicitS2
- if the second signature shall be implicit (application/pkcs7-mime) or
explicit (multipart/signed)signerCertificatesS2
- the certificate chain of the second signersignerPrivateKeyS2
- the private key of the second signerdigestAlgS2
- the digest algorithm to be used for digest calculation by the middle SignedContentsignatureAlgS2
- the algorithm to be used for signature calculation by the middle SignedContentmlExpansionHistoryS2
- MLExpansionHistory attribute to be added to the middle SignedContent; maybe nullimplicitS3
- if the first signature shall be implicit (application/pkcs7-mime) or
explicit (multipart/signed)signerCertificatesS3
- the certificate chain of the third signersignerPrivateKeyS3
- the private key of the third signerdigestAlgS3
- the digest algorithm to be used for digest calculation by the outermost SignedContentsignatureAlgS3
- the algorithm to be used for signature calculation by the outermost SignedContentmlExpansionHistoryS3
- MLExpansionHistory attribute to be added for the outermost SignedContent; maybe null
javax.mail.MessagingException
- if a problem occurs when creating the SignedContentpublic iaik.smime.EncryptedContent create_E1_S1_O(java.lang.Object content, java.lang.String contentType, boolean implicitS1, iaik.x509.X509Certificate[] signerCertificatesS1, java.security.PrivateKey signerPrivateKeyS1, iaik.asn1.structures.AlgorithmID digestAlgS1, iaik.asn1.structures.AlgorithmID signatureAlgS1, iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS1, iaik.x509.X509Certificate recipientCertificate, iaik.asn1.structures.AlgorithmID cekEncrAlg, iaik.asn1.structures.AlgorithmID contentEncrAlg, int cekLength) throws javax.mail.MessagingException
content
- the content to be signedcontentType
- the MIME type of the contentimplicitS1
- whether to create an implicit (application/pkcs7-mime) or
explicit (multipart/signed) messagesignerCertificatesS1
- the certificate chain of the signersignerPrivateKeyS1
- the private key to be used for signing the contentdigestAlgS1
- the algorithm to be used for digest calculationsignatureAlgS1
- the algorithm to be used for signature calculationmlExpansionHistoryS1
- MLExpansionHistory attribute to be added; maybe nullrecipientCertificate
- the encryption certificate of the recipientcekEncrAlg
- the algorithm to be used for encrypting the symmetric content encryption key
(e.g. AlgorithmID.rsaEncryption)contentEncrAlg
- the symmetric key to be used for encrypting the content, e.g. AlgorithmID.aes256_CBCcekLength
- the length of the temporary content encryption key to be generated (e.g. 256)
javax.mail.MessagingException
- if a problem occurs when creating the SignedContent or EncryptedContentpublic iaik.smime.SignedContent create_S2_E1_S1_0(java.lang.Object content, java.lang.String contentType, boolean implicitS1, iaik.x509.X509Certificate[] signerCertificatesS1, java.security.PrivateKey signerPrivateKeyS1, iaik.asn1.structures.AlgorithmID digestAlgS1, iaik.asn1.structures.AlgorithmID signatureAlgS1, iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS1, iaik.x509.X509Certificate recipientCertificate, iaik.asn1.structures.AlgorithmID cekEncrAlg, iaik.asn1.structures.AlgorithmID contentEncrAlg, int cekLength, boolean implicitS2, iaik.x509.X509Certificate[] signerCertificatesS2, java.security.PrivateKey signerPrivateKeyS2, iaik.asn1.structures.AlgorithmID digestAlgS2, iaik.asn1.structures.AlgorithmID signatureAlgS2, iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS2) throws javax.mail.MessagingException
content
- the content to be signedcontentType
- the MIME type of the contentimplicitS1
- if the first signature shall be implicit (application/pkcs7-mime) or
explicit (multipart/signed)signerCertificatesS1
- the certificate chain of the first signersignerPrivateKeyS1
- the private key of the first signerdigestAlgS1
- the digest algorithm to be used for digest calculation by the innermost SignedContentsignatureAlgS1
- the algorithm to be used for signature calculation by the innermost SignedContentmlExpansionHistoryS1
- MLExpansionHistory attribute to be added to the innermost SignedContent; maybe nullrecipientCertificate
- the encryption certificate of the recipientcekEncrAlg
- the algorithm to be used for encrypting the symmetric content encryption key
(e.g. AlgorithmID.rsaEncryption)contentEncrAlg
- the symmetric key to be used for encrypting the content, e.g. AlgorithmID.aes256_CBCcekLength
- the length of the temporary content encryption key to be generated (e.g. 256)implicitS2
- if the second signature shall be implicit (application/pkcs7-mime) or
explicit (multipart/signed)signerCertificatesS2
- the certificate chain of the second signersignerPrivateKeyS2
- the private key of the second signerdigestAlgS2
- the digest algorithm to be used for digest calculation by the outer SignedContentsignatureAlgS2
- the algorithm to be used for signature calculation by the outer SignedContentmlExpansionHistoryS2
- MLExpansionHistory attribute to be added to the outer SignedContent; maybe null
javax.mail.MessagingException
- if a problem occurs when creating a SignedContent or EncryptedContentpublic iaik.smime.SignedContent create_S3_S2_E1_S1_0(java.lang.Object content, java.lang.String contentType, boolean implicitS1, iaik.x509.X509Certificate[] signerCertificatesS1, java.security.PrivateKey signerPrivateKeyS1, iaik.asn1.structures.AlgorithmID digestAlgS1, iaik.asn1.structures.AlgorithmID signatureAlgS1, iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS1, iaik.x509.X509Certificate recipientCertificate, iaik.asn1.structures.AlgorithmID cekEncrAlg, iaik.asn1.structures.AlgorithmID contentEncrAlg, int cekLength, boolean implicitS2, iaik.x509.X509Certificate[] signerCertificatesS2, java.security.PrivateKey signerPrivateKeyS2, iaik.asn1.structures.AlgorithmID digestAlgS2, iaik.asn1.structures.AlgorithmID signatureAlgS2, iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS2, boolean implicitS3, iaik.x509.X509Certificate[] signerCertificatesS3, java.security.PrivateKey signerPrivateKeyS3, iaik.asn1.structures.AlgorithmID digestAlgS3, iaik.asn1.structures.AlgorithmID signatureAlgS3, iaik.smime.ess.MLExpansionHistory mlExpansionHistoryS3) throws javax.mail.MessagingException
content
- the content to be signedcontentType
- the MIME type of the contentimplicitS1
- if the first signature shall be implicit (application/pkcs7-mime) or
explicit (multipart/signed)signerCertificatesS1
- the certificate chain of the first signersignerPrivateKeyS1
- the private key of the first signerdigestAlgS1
- the digest algorithm to be used for digest calculation by the innermost SignedContentsignatureAlgS1
- the algorithm to be used for signature calculation by the innermost SignedContentmlExpansionHistoryS1
- MLExpansionHistory attribute to be added to the innermost SignedContent; maybe nullrecipientCertificate
- the encryption certificate of the recipientcekEncrAlg
- the algorithm to be used for encrypting the symmetric content encryption key
(e.g. AlgorithmID.rsaEncryption)contentEncrAlg
- the symmetric key to be used for encrypting the content, e.g. AlgorithmID.aes256_CBCcekLength
- the length of the temporary content encryption key to be generated (e.g. 256)implicitS2
- if the second signature shall be implicit (application/pkcs7-mime) or
explicit (multipart/signed)signerCertificatesS2
- the certificate chain of the second signersignerPrivateKeyS2
- the private key of the second signerdigestAlgS2
- the digest algorithm to be used for digest calculation by the middle SignedContentsignatureAlgS2
- the algorithm to be used for signature calculation by the middle SignedContentmlExpansionHistoryS2
- MLExpansionHistory attribute to be added to the middle SignedContent; maybe nullimplicitS3
- if the first signature shall be implicit (application/pkcs7-mime) or
explicit (multipart/signed)signerCertificatesS3
- the certificate chain of the third signersignerPrivateKeyS3
- the private key of the third signerdigestAlgS3
- the digest algorithm to be used for digest calculation by the outermost SignedContentsignatureAlgS3
- the algorithm to be used for signature calculation by the outermost SignedContentmlExpansionHistoryS3
- MLExpansionHistory attribute to be added for the outermost SignedContent; maybe null
javax.mail.MessagingException
- if a problem occurs when creating a SignedContent or EncryptedContentpublic javax.activation.DataHandler decrypt(iaik.smime.EncryptedContent ec, java.security.PrivateKey privateKey, iaik.x509.X509Certificate certificate) throws iaik.smime.SMimeException
ec
- the EncryptedContent to be decryptedprivateKey
- the private key to be used to decrypt the encrypted contentcertificate
- the certificate identifying the recipient for which to decrypt the encrypted content
iaik.smime.SMimeException
- if an error occurs while decrypting the contentpublic javax.activation.DataHandler verify(iaik.smime.SignedContent sc, iaik.x509.X509Certificate signerCert) throws iaik.cms.CMSSignatureException, javax.mail.MessagingException, iaik.smime.ess.ESSException
sc
- the SignedContent to be verifiedsignerCert
- the certificate of the signer (to check if the message has been signed
by the expected entity)
iaik.cms.CMSSignatureException
- if the signature is invalid
iaik.smime.ess.ESSException
- if an error occurs when accessing the inherent content or
the message has been signed by an unexpected entity
javax.mail.MessagingException
- if an error occurs when accessing the contentpublic void dumpContent(javax.activation.DataHandler dh) throws java.io.IOException, javax.mail.MessagingException
dh
- the dataHandler supplying the content of the original message
java.io.IOException
- if an I/O error occurs while dumping the content
javax.mail.MessagingException
- if an error occurs while reading the body parts of the messagepublic iaik.smime.SignedContent processMessageForMLA(javax.mail.Message msg, boolean implicit, java.lang.String debugID) throws iaik.smime.ess.utils.ESSLayerException, iaik.smime.ess.ESSException
iaik.smime.ess.utils.ESSLayerException
iaik.smime.ess.ESSException
public static iaik.smime.ess.MLExpansionHistory createMLExpansionHistory(iaik.x509.X509Certificate mlaCertificate, java.util.Date expansionTime, iaik.smime.ess.MLReceiptPolicy mlReceiptPolicy)
mlaCertificate
- the certificate of the MLA from which to create the
MLData EntityIdentiifier of type IssuerAndSerialNumberexpansionTime
- the expansion timemlReceiptPolicy
- the MLReceiptPolicy; may be null
public static void readMLExpansionHistory(iaik.smime.SignedContent signedContent, int count) throws java.lang.Exception
signedContent
- the (MLA created) SignedContent to be parsed for the MLExpansionHistory
attributecount
- the (expected) number of MLData entries included in the MLExpansionHistory attribute
java.lang.Exception
- if an error occurs when parsing the MLExpansionHistory attribute, or if
no MLExpansionHistory attribute is inlcuded or if the MLExpansionHistory
does contain an unexpected number of MLData entriespublic static void main(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception
|
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 |
![]() |