|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--demo.pkcs.EnvelopedDataOAEP
This class uses an RSACipherProvider
for en/decrypting the content encryption key of an EnvelopedData with RSA in
OAEP mode.
All keys and certificates are read from a keystore created by the SetupKeyStore program.
Constructor Summary | |
EnvelopedDataOAEP()
Setup the demo certificate chains. |
Method Summary | |
byte[] |
createEnvelopedData(byte[] message)
Creates a PKCS#7 EnvelopedData message. |
byte[] |
createEnvelopedDataStream(byte[] message)
Creates a PKCS#7 EnvelopedDataStream message. |
byte[] |
getEnvelopedData(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. |
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()
Tests the PKCS#7 content type implementations EnvelopedData ,
SignedData , and SignedAndEnvelopedData .
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EnvelopedDataOAEP() throws IOException
IOException
- if an file read error occursMethod Detail |
public byte[] createEnvelopedDataStream(byte[] message) throws PKCSException, IOException
EnvelopedDataStream
message.message
- the message to be enveloped, as byte representationPKCSException
- if the EnvelopedData
object cannot
be createdpublic byte[] getEnvelopedDataStream(byte[] encoding, PrivateKey privateKey, int recipientInfoIndex) throws PKCSException, IOException
encoding
- the DER encoded ContentInfo containing an EnvelopedData objectprivateKey
- 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 byte[] createEnvelopedData(byte[] message) throws PKCSException, IOException
EnvelopedData
message.message
- the message to be enveloped, as byte representationPKCSException
- if the EnvelopedData
object cannot
be createdpublic byte[] getEnvelopedData(byte[] encoding, PrivateKey privateKey, int recipientInfoIndex) throws PKCSException, IOException
EnvelopedData
object for the
specified recipient and returns the decrypted (= original) message.encoding
- the ContentInfo encoding holding an EnvelopedDataprivateKey
- 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()
EnvelopedData
,
SignedData
, and SignedAndEnvelopedData
.
An additional SignedAndEncryptedData test sequentially combines
signed and enveloped data, which should be prefered to the
SignedAndEnvelopedData
content type.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 |