public class EncryptedDataOutputStreamDemo extends java.lang.Object
EncryptedDataOutputStream
for
PBE encrypting data using the CMS type EnryptedData.Constructor and Description |
---|
EncryptedDataOutputStreamDemo()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
createEncryptedData(byte[] message,
char[] password)
Creates a CMS
EncryptedData and wraps it into a ContentInfo. |
byte[] |
getEncryptedData(byte[] encoding,
char[] password)
Decrypts the encrypted content of the given EncryptedData object.
|
static void |
main(java.lang.String[] argv)
Main method.
|
void |
start()
Starts the demo.
|
public EncryptedDataOutputStreamDemo()
public byte[] createEncryptedData(byte[] message, char[] password) throws iaik.cms.CMSException, java.io.IOException
EncryptedData
and wraps it into a ContentInfo.message
- the message to be encrypted, as byte representationiaik.cms.CMSException
- if the EncryptedData
object cannot
be createdjava.io.IOException
- if an I/O error occurspublic byte[] getEncryptedData(byte[] encoding, char[] password) throws iaik.cms.CMSException, java.io.IOException
encoding
- the encoded EncryptedData object, wrapped in a ContentInfopassword
- the password to decrypt the messageiaik.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 an some error occurs