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 Object

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

Field Summary
protected  Cipher cipher
           
protected  Data data
           
protected  Key key
           
 
Constructor Summary
CryptoProcessor()
           
CryptoProcessor(int mode, String algo, Data ed, Key key)
          Creates a new instance of EncryptionProcessor
CryptoProcessor(int mode, String algo, Key key)
           
CryptoProcessor(int mode, String algo, Key dk, Key key)
           
 
Method Summary
protected  String convertAlgURIToTransformation(String algorithmURI)
          Convert algorithm URI to actual transformation (DES/CBC/PKCS5Padding)
 byte[] decryptData(byte[] encryptedContent)
          decrypts the encryptedContent which a byte[]
 InputStream decryptData(InputStream is)
          decrypts the given data which is of the form InputStream
 Key decryptKey(byte[] encryptedKey, String encAlgo)
          decrypts the encrypted key which is a byte[] with encAlgo algorithm
 void encrypt(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(OutputStream eos)
          initialises the Cipher and encrypts the data which is a OutputStream and writes the encrypted data into the data member
 void encryptKey(OutputStream outputStream)
          wraps the data encryption key to byte[] and writes it to output stream
protected  String getAlgorithm()
           
 byte[] getCipherValueOfEK()
          wraps the data encryption key .
protected  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 Cipher cipher

key

protected Key key

data

protected Data data
Constructor Detail

CryptoProcessor

public CryptoProcessor()

CryptoProcessor

public CryptoProcessor(int mode,
                       String algo,
                       Data ed,
                       Key key)
                throws XWSSecurityException
Creates a new instance of EncryptionProcessor

Throws:
XWSSecurityException

CryptoProcessor

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

CryptoProcessor

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

initCipher

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

Throws:
NoSuchAlgorithmException
NoSuchPaddingException
InvalidKeyException

getAlgorithm

protected String getAlgorithm()

convertAlgURIToTransformation

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

Parameters:
algorithmURI -
Returns:
String representing transforms

getKey

protected Key getKey()

encrypt

public void encrypt(OutputStream outputStream)
             throws IOException
encrypts outputStream

Parameters:
outputStream -
Throws:
IOException

getCipherValueOfEK

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

Returns:
ed byte[]

encryptKey

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

Parameters:
outputStream - OutputStream
Throws:
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(OutputStream eos)
                 throws 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:
IOException

decryptKey

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

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

decryptData

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

Parameters:
is - InputStream
Returns:
InputStream
Throws:
IOException

decryptData

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

Parameters:
encryptedContent - byte[]
Returns:
byte[]
Throws:
IOException


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