Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

cryptix.jce.provider.pk
Class RSACipher_ECB_PKCS1  view RSACipher_ECB_PKCS1 download RSACipher_ECB_PKCS1.java

java.lang.Object
  extended byjavax.crypto.CipherSpi
      extended bycryptix.jce.provider.pk.RSACipher_ECB_PKCS1

public final class RSACipher_ECB_PKCS1
extends javax.crypto.CipherSpi

Please read the comments in the source.

Version:
$Revision: 1.12 $

Field Summary
private  boolean decrypt
           
private  java.math.BigInteger e
           
private  java.math.BigInteger n
           
private  java.math.BigInteger p
           
private  java.math.BigInteger q
           
private  java.math.BigInteger u
           
 
Constructor Summary
RSACipher_ECB_PKCS1()
           
 
Method Summary
protected  byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen)
          Finishes a multi-part transformation or transforms a portion of a byte array, and returns the transformed bytes.
protected  int engineDoFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)
          Finishes a multi-part transformation or transforms a portion of a byte array, and stores the transformed bytes in the supplied array.
protected  int engineGetBlockSize()
          Returns the block size of the underlying cipher.
protected  byte[] engineGetIV()
          Returns the initializaiton vector this cipher was initialized with, if any.
protected  int engineGetOutputSize(int inputLen)
          Returns the size, in bytes, an output buffer must be for a call to engineUpdate(byte[],int,int,byte[],int) 55 or engineDoFinal(byte[],int,int,byte[],int) 55 to succeed.
protected  java.security.AlgorithmParameters engineGetParameters()
          Returns the parameters that this cipher is using.
protected  void engineInit(int opmode, java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)
          Initializes this cipher with an operation mode, key, parameters, and source of randomness.
protected  void engineInit(int opmode, java.security.Key key, java.security.AlgorithmParameters params, java.security.SecureRandom random)
          Initializes this cipher with an operation mode, key, parameters, and source of randomness.
protected  void engineInit(int opmode, java.security.Key key, java.security.SecureRandom random)
          Initializes this cipher with an operation mode, key, and source of randomness.
protected  void engineSetMode(java.lang.String mode)
          Set the mode in which this cipher is to run.
protected  void engineSetPadding(java.lang.String padding)
          Set the method with which the input is to be padded.
protected  java.security.Key engineUnwrap(byte[] wrappedKey, java.lang.String wrappedKeyAlgorithm, int wrappedKeyType)
          Unwraps a previously-wrapped key.
protected  byte[] engineUpdate(byte[] input, int inputOffset, int inputLen)
          Continue with a multi-part transformation, returning a new array of the transformed bytes.
protected  int engineUpdate(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)
          Continue with a multi-part transformation, storing the transformed bytes into the specified array.
protected  byte[] engineWrap(java.security.Key key)
          Wrap a key.
private  byte[] pad(byte[] input, int inputLen, int offset, int bt)
           
private  int unpad(byte[] input, int inputLen, int inOffset, byte[] output, int outOffset)
           
 
Methods inherited from class javax.crypto.CipherSpi
engineDoFinal, engineGetKeySize, engineUpdate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

n

private java.math.BigInteger n

e

private java.math.BigInteger e

p

private java.math.BigInteger p

q

private java.math.BigInteger q

u

private java.math.BigInteger u

decrypt

private boolean decrypt
Constructor Detail

RSACipher_ECB_PKCS1

public RSACipher_ECB_PKCS1()
Method Detail

engineSetMode

protected final void engineSetMode(java.lang.String mode)
                            throws java.security.NoSuchAlgorithmException
Description copied from class: javax.crypto.CipherSpi
Set the mode in which this cipher is to run.


engineSetPadding

protected final void engineSetPadding(java.lang.String padding)
                               throws javax.crypto.NoSuchPaddingException
Description copied from class: javax.crypto.CipherSpi
Set the method with which the input is to be padded.


engineGetBlockSize

protected final int engineGetBlockSize()
Description copied from class: javax.crypto.CipherSpi
Returns the block size of the underlying cipher.


engineGetOutputSize

protected final int engineGetOutputSize(int inputLen)
Description copied from class: javax.crypto.CipherSpi

Returns the size, in bytes, an output buffer must be for a call to CipherSpi.engineUpdate(byte[],int,int,byte[],int)>CipherSpi.engineUpdate(byte[],int,int,byte[],int) 55 or CipherSpi.engineDoFinal(byte[],int,int,byte[],int)>CipherSpi.engineDoFinal(byte[],int,int,byte[],int) 55 to succeed.

The actual output length may be smaller than the value returned by this method, as it considers the padding length as well. The length considered is the argument plus the length of any buffered, unprocessed bytes.


engineGetIV

protected final byte[] engineGetIV()
Description copied from class: javax.crypto.CipherSpi
Returns the initializaiton vector this cipher was initialized with, if any.


engineGetParameters

protected final java.security.AlgorithmParameters engineGetParameters()
Description copied from class: javax.crypto.CipherSpi
Returns the parameters that this cipher is using. This may be the parameters used to initialize this cipher, or it may be parameters that have been initialized with random values.


engineInit

protected final void engineInit(int opmode,
                                java.security.Key key,
                                java.security.SecureRandom random)
                         throws java.security.InvalidKeyException
Description copied from class: javax.crypto.CipherSpi
Initializes this cipher with an operation mode, key, and source of randomness. If this cipher requires any other initializing data, for example an initialization vector, then it should generate it from the provided source of randomness.


engineInit

protected final void engineInit(int opmode,
                                java.security.Key key,
                                java.security.spec.AlgorithmParameterSpec params,
                                java.security.SecureRandom random)
                         throws java.security.InvalidKeyException,
                                java.security.InvalidAlgorithmParameterException
Description copied from class: javax.crypto.CipherSpi
Initializes this cipher with an operation mode, key, parameters, and source of randomness. If this cipher requires any other initializing data, for example an initialization vector, then it should generate it from the provided source of randomness.


engineInit

protected final void engineInit(int opmode,
                                java.security.Key key,
                                java.security.AlgorithmParameters params,
                                java.security.SecureRandom random)
                         throws java.security.InvalidKeyException,
                                java.security.InvalidAlgorithmParameterException
Description copied from class: javax.crypto.CipherSpi
Initializes this cipher with an operation mode, key, parameters, and source of randomness. If this cipher requires any other initializing data, for example an initialization vector, then it should generate it from the provided source of randomness.


engineUpdate

protected final byte[] engineUpdate(byte[] input,
                                    int inputOffset,
                                    int inputLen)
Description copied from class: javax.crypto.CipherSpi
Continue with a multi-part transformation, returning a new array of the transformed bytes.


engineUpdate

protected final int engineUpdate(byte[] input,
                                 int inputOffset,
                                 int inputLen,
                                 byte[] output,
                                 int outputOffset)
                          throws javax.crypto.ShortBufferException
Description copied from class: javax.crypto.CipherSpi
Continue with a multi-part transformation, storing the transformed bytes into the specified array.


engineDoFinal

protected final byte[] engineDoFinal(byte[] input,
                                     int inputOffset,
                                     int inputLen)
                              throws javax.crypto.IllegalBlockSizeException,
                                     javax.crypto.BadPaddingException
Description copied from class: javax.crypto.CipherSpi
Finishes a multi-part transformation or transforms a portion of a byte array, and returns the transformed bytes.


engineDoFinal

protected final int engineDoFinal(byte[] input,
                                  int inputOffset,
                                  int inputLen,
                                  byte[] output,
                                  int outputOffset)
                           throws javax.crypto.ShortBufferException,
                                  javax.crypto.IllegalBlockSizeException,
                                  javax.crypto.BadPaddingException
Description copied from class: javax.crypto.CipherSpi
Finishes a multi-part transformation or transforms a portion of a byte array, and stores the transformed bytes in the supplied array.


engineWrap

protected byte[] engineWrap(java.security.Key key)
                     throws javax.crypto.IllegalBlockSizeException,
                            java.security.InvalidKeyException
Description copied from class: javax.crypto.CipherSpi

Wrap a key.

For compatibility this method is not declared abstract, and the default implementation will throw an java.lang.UnsupportedOperationException.


engineUnwrap

protected java.security.Key engineUnwrap(byte[] wrappedKey,
                                         java.lang.String wrappedKeyAlgorithm,
                                         int wrappedKeyType)
                                  throws java.security.InvalidKeyException,
                                         java.security.NoSuchAlgorithmException
Description copied from class: javax.crypto.CipherSpi

Unwraps a previously-wrapped key.

For compatibility this method is not declared abstract, and the default implementation will throw an java.lang.UnsupportedOperationException.


pad

private byte[] pad(byte[] input,
                   int inputLen,
                   int offset,
                   int bt)
            throws javax.crypto.BadPaddingException

unpad

private int unpad(byte[] input,
                  int inputLen,
                  int inOffset,
                  byte[] output,
                  int outOffset)
           throws javax.crypto.BadPaddingException