|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--demo.pkcs.TestEncryptedContentInfo
This class demonstrates the EnvelopedDataStream/EncryptedContentInfoStream usages for algorithms that require a specific parameter handling.
All keys and certificates are read from a keystore created by the SetupKeyStore program.
The following algorithms are demonstrated:
RC2-CBC parameter ::= SEQUENCE { rc2ParameterVersion INTEGER, iv OCTET STRING (8)} For the effective-key-bits of 40, 64, and 128, the rc2ParameterVersion values are 160, 120, 58 respectively.
Parameters ::= SEQUENCE { iv OCTET STRING DEFAULT 0, keyLength INTEGER }
Constructor Summary | |
TestEncryptedContentInfo()
Setup the demo certificate chains. |
Method Summary | |
byte[] |
createEnvelopedDataStream(byte[] message,
AlgorithmID contentEA,
int keyLength)
Creates a PKCS#7 EnvelopedDataStream message.
|
byte[] |
getEnvelopedDataStream(byte[] encoding,
PrivateKey privateKey,
int recipientInfoIndex)
Decrypts the encrypted content of the given EnvelopedData object for the
specified recipient and returns the decrypted (= original) message. |
static void |
main(String[] argv)
Starts the PKCS#7 content type implementation tests. |
void |
start()
Starts the test. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TestEncryptedContentInfo() throws IOException
IOException
- if an file read error occursMethod Detail |
public byte[] createEnvelopedDataStream(byte[] message, AlgorithmID contentEA, int keyLength) throws Exception
EnvelopedDataStream
message.
The enveloped-data content type consists of encrypted content of any type and encrypted content-encryption keys for one or more recipients. The combination of encrypted content and encrypted content-encryption key for a recipient is a "digital envelope" for that recipient. Any type of content can be enveloped for any number of recipients in parallel.
message
- the message to be enveloped, as byte representationcontentEA
- the content encryption algorithmkeyLength
- the key length for the symmetric keyEnvelopedData
object just createdPKCSException
- if the EnvelopedData
object cannot
be createdpublic byte[] getEnvelopedDataStream(byte[] encoding, PrivateKey privateKey, int recipientInfoIndex) throws Exception
EnvelopedData
object for the
specified recipient and returns the decrypted (= original) message.encoding
- the EnvelopedData
object as DER encoded byte arrayprivateKey
- the private key to decrypt the messagerecipientInfoIndex
- the index into the RecipientInfo
array
to which the specified private key belongsPKCSException
- if the message cannot be recoveredpublic void start()
public static void main(String[] argv) throws Exception
IOException
- if an I/O error occurs when reading required keys
and certificates from files
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |