public class PasswordRecipientInfoDemo extends java.lang.Object
PasswordRecipientInfo
as specified by RFC 5652.Constructor and Description |
---|
PasswordRecipientInfoDemo()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
createEnvelopedData(byte[] message,
char[] password,
iaik.asn1.structures.AlgorithmID keyDerivationAlg,
java.security.spec.AlgorithmParameterSpec keyDerivatoinParamSpec,
iaik.asn1.structures.AlgorithmID keyEncrAlg,
java.security.AlgorithmParameters keyEncrParams)
Creates a CMS
EnvelopedData with a PasswordRecipientInfo
and wraps it into a ContentInfo. |
byte[] |
createEnvelopedDataStream(byte[] message,
char[] password,
iaik.asn1.structures.AlgorithmID keyDerivationAlg,
java.security.spec.AlgorithmParameterSpec keyDerivatoinParamSpec,
iaik.asn1.structures.AlgorithmID keyEncrAlg,
java.security.AlgorithmParameters keyEncrParams)
Creates a CMS
EnvelopedData with a PasswordRecipientInfo
and wraps it into a ContentInfo (stream implementation). |
byte[] |
getEnvelopedData(byte[] encoding,
char[] password,
java.lang.String cekAlgName)
PBE based decrypts the encrypted content of the given EnvelopedData object
and returns the decrypted (= original) message.
|
byte[] |
getEnvelopedDataStream(byte[] encoding,
char[] password,
java.lang.String cekAlgName)
PBE based decrypts the encrypted content of the given EnvelopedData object
and returns the decrypted (= original) message (stream implementation).
|
static void |
main(java.lang.String[] argv)
Main method.
|
void |
start()
Starts the demo.
|
public PasswordRecipientInfoDemo()
public byte[] createEnvelopedDataStream(byte[] message, char[] password, iaik.asn1.structures.AlgorithmID keyDerivationAlg, java.security.spec.AlgorithmParameterSpec keyDerivatoinParamSpec, iaik.asn1.structures.AlgorithmID keyEncrAlg, java.security.AlgorithmParameters keyEncrParams) throws iaik.cms.CMSException, java.io.IOException
EnvelopedData
with a PasswordRecipientInfo
and wraps it into a ContentInfo (stream implementation).message
- the message to be enveloped, as byte representationpassword
- the password from which to derive the key encryption key (kek)keyDerivationAlg
- the key derivation function to be used for deriving the kekkeyDerivatoinParamSpec
- any parameters required by the key derivation functionkeyEncrAlg
- the ID of the key-encryption (key-wrap) algorithm to be used
for encrypting the content-encryption keykeyEncrParams
- any algorithm parameters to be used for intializing the
key wrap cipheriaik.cms.CMSException
- if the EnvelopedData
object cannot
be createdjava.io.IOException
- if an I/O error occurspublic byte[] getEnvelopedDataStream(byte[] encoding, char[] password, java.lang.String cekAlgName) throws iaik.cms.CMSException, java.io.IOException
encoding
- the encoded ContentInfo containing an EnvelopedData objectpassword
- the password from which to derive the key-encryption key (kek)
to be used for decrypting the content-encryption key (cek)cekAlgName
- the name of the cek (content encryption key) algorithmiaik.cms.CMSException
- if the message cannot be recoveredjava.io.IOException
- if an I/O error occurspublic byte[] createEnvelopedData(byte[] message, char[] password, iaik.asn1.structures.AlgorithmID keyDerivationAlg, java.security.spec.AlgorithmParameterSpec keyDerivatoinParamSpec, iaik.asn1.structures.AlgorithmID keyEncrAlg, java.security.AlgorithmParameters keyEncrParams) throws iaik.cms.CMSException
EnvelopedData
with a PasswordRecipientInfo
and wraps it into a ContentInfo.message
- the message to be enveloped, as byte representationpassword
- the password from which to derive the key encryption key (kek)keyDerivationAlg
- the key derivation function to be used for deriving the kekkeyDerivatoinParamSpec
- any parameters required by the key derivation functionkeyEncrAlg
- the ID of the key-encryption (key-wrap) algorithm to be used
for encrypting the content-encryption keykeyEncrParams
- any algorithm parameters to be used for intializing the
key wrap cipheriaik.cms.CMSException
- if the EnvelopedData
object cannot
be createdpublic byte[] getEnvelopedData(byte[] encoding, char[] password, java.lang.String cekAlgName) throws iaik.cms.CMSException, java.io.IOException
encoding
- the encoded ContentInfo containing an EnvelopedData objectpassword
- the password from which to derive the key-encryption key (kek)
to be used for decrypting the content-encryption key (cek)cekAlgName
- the name of the cek (content encryption key) algorithmiaik.cms.CMSException
- if the message cannot be recoveredjava.io.IOException
- if an I/O error occurspublic void start()
public static void main(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception
- if some error occurs