com.sun.xml.ws.security.opt.impl.enc
Class CryptoProcessor

java.lang.Object
  extended by com.sun.xml.ws.security.opt.impl.enc.CryptoProcessor
Direct Known Subclasses:
DataEncryptionProcessor, KeyEncryptionProcessor

public class CryptoProcessor
extends java.lang.Object

Author:
K.Venugopal@sun.com, Abhijit.Das@Sun.COM

Field Summary
protected  javax.crypto.Cipher cipher
           
protected  javax.xml.crypto.Data data
           
protected  java.security.Key key
           
 
Constructor Summary
CryptoProcessor()
           
CryptoProcessor(int mode, java.lang.String algo, javax.xml.crypto.Data ed, java.security.Key key)
          Creates a new instance of EncryptionProcessor
CryptoProcessor(int mode, java.lang.String algo, java.security.Key key)
           
CryptoProcessor(int mode, java.lang.String algo, java.security.Key dk, java.security.Key key)
           
 
Method Summary
protected  java.lang.String convertAlgURIToTransformation(java.lang.String algorithmURI)
          Convert algorithm URI to actual transformation (DES/CBC/PKCS5Padding)
 byte[] decryptData(byte[] encryptedContent)
          decrypts the encryptedContent which a byte[]
 java.io.InputStream decryptData(java.io.InputStream is)
          decrypts the given data which is of the form InputStream
 java.security.Key decryptKey(byte[] encryptedKey, java.lang.String encAlgo)
          decrypts the encrypted key which is a byte[] with encAlgo algorithm
 void encrypt(java.io.OutputStream outputStream)
          encrypts outputStream
 byte[] encryptData(byte[] cipherInput)
          initialises the Cipher and encrypts the data which is a byte[] and returns the encrypted data
 void encryptData(java.io.OutputStream eos)
          initialises the Cipher and encrypts the data which is a OutputStream and writes the encrypted data into the data member
 void encryptKey(java.io.OutputStream outputStream)
          wraps the data encryption key to byte[] and writes it to output stream
protected  java.lang.String getAlgorithm()
           
 byte[] getCipherValueOfEK()
          wraps the data encryption key .
protected  java.security.Key getKey()
           
protected  void initCipher()
          creates an instance of javax.crypto.Cipher class and inits it .
 void setEncryptedDataCV(byte[] cv)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cipher

protected javax.crypto.Cipher cipher

key

protected java.security.Key key

data

protected javax.xml.crypto.Data data
Constructor Detail

CryptoProcessor

public CryptoProcessor()

CryptoProcessor

public CryptoProcessor(int mode,
                       java.lang.String algo,
                       javax.xml.crypto.Data ed,
                       java.security.Key key)
                throws XWSSecurityException
Creates a new instance of EncryptionProcessor

Throws:
XWSSecurityException

CryptoProcessor

public CryptoProcessor(int mode,
                       java.lang.String algo,
                       java.security.Key dk,
                       java.security.Key key)
                throws XWSSecurityException
Throws:
XWSSecurityException

CryptoProcessor

public CryptoProcessor(int mode,
                       java.lang.String algo,
                       java.security.Key key)
                throws XWSSecurityException
Throws:
XWSSecurityException
Method Detail

initCipher

protected void initCipher()
                   throws java.security.NoSuchAlgorithmException,
                          javax.crypto.NoSuchPaddingException,
                          java.security.InvalidKeyException
creates an instance of javax.crypto.Cipher class and inits it .

Throws:
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException
java.security.InvalidKeyException

getAlgorithm

protected java.lang.String getAlgorithm()

convertAlgURIToTransformation

protected java.lang.String convertAlgURIToTransformation(java.lang.String algorithmURI)
Convert algorithm URI to actual transformation (DES/CBC/PKCS5Padding)

Parameters:
algorithmURI -
Returns:
String representing transforms

getKey

protected java.security.Key getKey()

encrypt

public void encrypt(java.io.OutputStream outputStream)
             throws java.io.IOException
encrypts outputStream

Parameters:
outputStream -
Throws:
java.io.IOException

getCipherValueOfEK

public byte[] getCipherValueOfEK()
wraps the data encryption key .

Returns:
ed byte[]

encryptKey

public void encryptKey(java.io.OutputStream outputStream)
                throws java.io.IOException
wraps the data encryption key to byte[] and writes it to output stream

Parameters:
outputStream - OutputStream
Throws:
java.io.IOException

setEncryptedDataCV

public void setEncryptedDataCV(byte[] cv)

encryptData

public byte[] encryptData(byte[] cipherInput)
initialises the Cipher and encrypts the data which is a byte[] and returns the encrypted data

Parameters:
cipherInput - byte[]
Returns:
encryptedBytes byte[]

encryptData

public void encryptData(java.io.OutputStream eos)
                 throws java.io.IOException
initialises the Cipher and encrypts the data which is a OutputStream and writes the encrypted data into the data member

Parameters:
eos - OutputStream
Throws:
java.io.IOException

decryptKey

public java.security.Key decryptKey(byte[] encryptedKey,
                                    java.lang.String encAlgo)
                             throws java.io.IOException
decrypts the encrypted key which is a byte[] with encAlgo algorithm

Parameters:
encryptedKey - byte[]
encAlgo - String
Returns:
Key
Throws:
java.io.IOException

decryptData

public java.io.InputStream decryptData(java.io.InputStream is)
                                throws java.io.IOException
decrypts the given data which is of the form InputStream

Parameters:
is - InputStream
Returns:
InputStream
Throws:
java.io.IOException

decryptData

public byte[] decryptData(byte[] encryptedContent)
                   throws java.io.IOException
decrypts the encryptedContent which a byte[]

Parameters:
encryptedContent - byte[]
Returns:
byte[]
Throws:
java.io.IOException


Copyright © 2005-2013 Oracle Corporation. All Rights Reserved.