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

Quick Search    Search Deep

cryptix.jce.provider.rsa
Class RSASignature_PSS  view RSASignature_PSS download RSASignature_PSS.java

java.lang.Object
  extended byjava.security.SignatureSpi
      extended bycryptix.jce.provider.rsa.RSASignature_PSS
Direct Known Subclasses:
RSASignature_PSS_MD2, RSASignature_PSS_MD4, RSASignature_PSS_MD5, RSASignature_PSS_RIPEMD128, RSASignature_PSS_RIPEMD160, RSASignature_PSS_SHA1, RSASignature_PSS_SHA256, RSASignature_PSS_SHA384, RSASignature_PSS_SHA512, RSASignature_PSS_Tiger

public abstract class RSASignature_PSS
extends java.security.SignatureSpi

Implementation of the RSASSA-PSS signature scheme as described in RSA Labs' PKCS#1v2.

Version:
$Revision: 1.3 $

Field Summary
private  int emBits
          Exact bit-length of encoded message (modulus len - 1).
private  int emLen
          Byte length of encoded message: emLen = ceil(emBits/8).
private  java.math.BigInteger exp
          Various components of our RSA[Private|Public]Key.
private  int hLen
          Length of hash (in bytes).
private static byte[] MASK
          Bitmasks of least significant bits indexed by bitcount.
private  java.security.MessageDigest md
          Hash instance for this signature instance.
private  java.math.BigInteger n
          Various components of our RSA[Private|Public]Key.
private  java.math.BigInteger p
          Various components of our RSA[Private|Public]Key.
private  byte[] presetSalt
          XXX If !null, this will be used as salt in lieu of randomness.
private  java.math.BigInteger q
          Various components of our RSA[Private|Public]Key.
private  java.security.SecureRandom rng
          RNG
private  int sLen
          Length of salt (in bytes).
private  java.math.BigInteger u
          Various components of our RSA[Private|Public]Key.
 
Fields inherited from class java.security.SignatureSpi
appRandom
 
Constructor Summary
RSASignature_PSS(java.lang.String hashName)
           
 
Method Summary
private  byte[] concat(byte[] a, byte[] b)
           
private  byte[] concat(byte[] a, byte[] b, byte[] c)
           
protected  java.lang.Object engineGetParameter(java.lang.String a)
          Returns the value for the specified algorithm parameter.
protected  void engineInitSign(java.security.PrivateKey privateKey)
          Initializes this instance with the private key for signing purposes.
protected  void engineInitSign(java.security.PrivateKey key, java.security.SecureRandom random)
          Initializes this instance with the private key and source of randomness for signing purposes.
protected  void engineInitVerify(java.security.PublicKey key)
          Initializes this instance with the public key for verification purposes.
protected  void engineSetParameter(java.lang.String name, java.lang.Object param)
          Sets the specified algorithm parameter to the specified value.
protected  byte[] engineSign()
          Returns the signature bytes of all the data fed to this instance.
protected  void engineUpdate(byte b)
          Updates the data to be signed or verified with the specified byte.
protected  void engineUpdate(byte[] buf, int off, int len)
          Updates the data to be signed or verified with the specified bytes.
protected  boolean engineVerify(byte[] signature)
          Verifies a designated signature.
private  int getModulusBitLen()
           
private  int getModulusLen()
           
private  void initCommon()
           
private  byte[] mgf1(byte[] seed, int len)
           
private  byte[] mgf1Hash(byte[] seed, byte c)
           
private  boolean pssVerify(byte[] mHash, byte[] em, int emBits)
           
private static byte[] xor(byte[] a, byte[] b)
           
 
Methods inherited from class java.security.SignatureSpi
clone, engineGetParameters, engineSetParameter, engineSign, engineVerify
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MASK

private static final byte[] MASK
Bitmasks of least significant bits indexed by bitcount.


md

private final java.security.MessageDigest md
Hash instance for this signature instance.


hLen

private final int hLen
Length of hash (in bytes).


sLen

private final int sLen
Length of salt (in bytes).


presetSalt

private byte[] presetSalt
XXX If !null, this will be used as salt in lieu of randomness. This allows the signature to behave deterministically for testing purposes.


emLen

private int emLen
Byte length of encoded message: emLen = ceil(emBits/8).


emBits

private int emBits
Exact bit-length of encoded message (modulus len - 1).


exp

private java.math.BigInteger exp
Various components of our RSA[Private|Public]Key.


n

private java.math.BigInteger n
Various components of our RSA[Private|Public]Key.


p

private java.math.BigInteger p
Various components of our RSA[Private|Public]Key.


q

private java.math.BigInteger q
Various components of our RSA[Private|Public]Key.


u

private java.math.BigInteger u
Various components of our RSA[Private|Public]Key.


rng

private java.security.SecureRandom rng
RNG

Constructor Detail

RSASignature_PSS

public RSASignature_PSS(java.lang.String hashName)
Method Detail

engineGetParameter

protected java.lang.Object engineGetParameter(java.lang.String a)
Description copied from class: java.security.SignatureSpi
Returns the value for the specified algorithm parameter.


engineInitSign

protected void engineInitSign(java.security.PrivateKey key,
                              java.security.SecureRandom random)
                       throws java.security.InvalidKeyException
Description copied from class: java.security.SignatureSpi
Initializes this instance with the private key and source of randomness for signing purposes.

This method cannot be abstract for backward compatibility reasons.


engineInitSign

protected void engineInitSign(java.security.PrivateKey privateKey)
                       throws java.security.InvalidKeyException
Description copied from class: java.security.SignatureSpi
Initializes this instance with the private key for signing purposes.


engineInitVerify

protected void engineInitVerify(java.security.PublicKey key)
                         throws java.security.InvalidKeyException
Description copied from class: java.security.SignatureSpi
Initializes this instance with the public key for verification purposes.


initCommon

private void initCommon()
                 throws java.security.InvalidKeyException

engineSetParameter

protected void engineSetParameter(java.lang.String name,
                                  java.lang.Object param)
Description copied from class: java.security.SignatureSpi
Sets the specified algorithm parameter to the specified value.


engineSign

protected byte[] engineSign()
Description copied from class: java.security.SignatureSpi
Returns the signature bytes of all the data fed to this instance. The format of the output depends on the underlying signature algorithm.


getModulusLen

private int getModulusLen()

getModulusBitLen

private int getModulusBitLen()

xor

private static byte[] xor(byte[] a,
                          byte[] b)

mgf1

private byte[] mgf1(byte[] seed,
                    int len)

mgf1Hash

private byte[] mgf1Hash(byte[] seed,
                        byte c)

concat

private byte[] concat(byte[] a,
                      byte[] b)

concat

private byte[] concat(byte[] a,
                      byte[] b,
                      byte[] c)

engineUpdate

protected void engineUpdate(byte b)
Description copied from class: java.security.SignatureSpi
Updates the data to be signed or verified with the specified byte.


engineUpdate

protected void engineUpdate(byte[] buf,
                            int off,
                            int len)
Description copied from class: java.security.SignatureSpi
Updates the data to be signed or verified with the specified bytes.


engineVerify

protected boolean engineVerify(byte[] signature)
Description copied from class: java.security.SignatureSpi
Verifies a designated signature.


pssVerify

private boolean pssVerify(byte[] mHash,
                          byte[] em,
                          int emBits)