Top Description Fields Constructors Methods
org.bouncycastle.crypto.signers

public Class PSSSigner

extends Object
implements Signer
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.Signer
Imports
java.security.SecureRandom, org.bouncycastle.crypto.AsymmetricBlockCipher, .CipherParameters, .CryptoException, .CryptoServicesRegistrar, .DataLengthException, .Digest, .Signer, .Xof, org.bouncycastle.crypto.digests.NullDigest, org.bouncycastle.crypto.params.ParametersWithRandom, .RSABlindingParameters, .RSAKeyParameters, org.bouncycastle.util.Arrays

RSA-PSS as described in PKCS# 1 v 2.1.

Note

the usual value for the salt length is the number of bytes in the hash function.

Field Summary

Modifier and TypeField and Description
private byte[]
private AsymmetricBlockCipher
private Digest
private Digest
private int
private int
private byte[]
private Digest
private int
private SecureRandom
private byte[]
private int
private boolean
private byte
public static final byte

Constructor Summary

AccessConstructor and Description
public
PSSSigner(AsymmetricBlockCipher
the asymmetric cipher to use.
cipher
,
Digest
the digest to use.
digest
,
int
the length of the salt to use (in bytes).
sLen
)

basic constructor

public
PSSSigner(AsymmetricBlockCipher cipher, Digest contentDigest, Digest mgfDigest, int sLen)

public
PSSSigner(AsymmetricBlockCipher cipher, Digest digest, int sLen, byte trailer)

public
PSSSigner(AsymmetricBlockCipher cipher, Digest contentDigest, Digest mgfDigest, int sLen, byte trailer)

private
PSSSigner(AsymmetricBlockCipher cipher, Digest contentDigest1, Digest contentDigest2, Digest mgfDigest, int sLen, byte trailer)

public
PSSSigner(AsymmetricBlockCipher cipher, Digest digest, byte[] salt)

public
PSSSigner(AsymmetricBlockCipher cipher, Digest contentDigest, Digest mgfDigest, byte[] salt)

public
PSSSigner(AsymmetricBlockCipher cipher, Digest contentDigest, Digest mgfDigest, byte[] salt, byte trailer)

private
PSSSigner(AsymmetricBlockCipher cipher, Digest contentDigest1, Digest contentDigest2, Digest mgfDigest, byte[] salt, byte trailer)

Method Summary

Modifier and TypeMethod and Description
private void
clearBlock(byte[] block)

clear possible sensitive data

public static PSSSigner
createRawSigner(AsymmetricBlockCipher cipher, Digest contentDigest, Digest mgfDigest, int sLen, byte trailer)

public static PSSSigner
createRawSigner(AsymmetricBlockCipher cipher, Digest contentDigest, Digest mgfDigest, byte[] salt, byte trailer)

public byte[]
generateSignature()

Implements org.bouncycastle.crypto.Signer.generateSignature.

generate a signature for the message we've been loaded with using the key we were initialised with.
public void
init(boolean
true if for signing, false otherwise
forSigning
,
CipherParameters
necessary parameters.
param
)

Implements org.bouncycastle.crypto.Signer.init.

Initialise the signer for signing or verification.
private void
ItoOSP(int i, byte[] sp)

int to octet string.

private byte[]
maskGenerator(byte[] Z, int zOff, int zLen, int length)

private byte[]
maskGeneratorFunction1(byte[] Z, int zOff, int zLen, int length)

mask generator function, as described in PKCS1v2.

public void
reset()

Implements org.bouncycastle.crypto.Signer.reset.

reset the internal state
public void
update(byte b)

Implements org.bouncycastle.crypto.Signer.update.

update the internal digest with the byte b
public void
update(byte[] in, int off, int len)

Implements org.bouncycastle.crypto.Signer.update.

update the internal digest with the byte array in
public boolean
verifySignature(byte[] signature)

Implements org.bouncycastle.crypto.Signer.verifySignature.

return true if the internal state represents the signature described in the passed in array.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

blockback to summary
private byte[] block
cipherback to summary
private AsymmetricBlockCipher cipher
contentDigest1back to summary
private Digest contentDigest1
contentDigest2back to summary
private Digest contentDigest2
emBitsback to summary
private int emBits
hLenback to summary
private int hLen
mDashback to summary
private byte[] mDash
mgfDigestback to summary
private Digest mgfDigest
mgfhLenback to summary
private int mgfhLen
randomback to summary
private SecureRandom random
saltback to summary
private byte[] salt
sLenback to summary
private int sLen
sSetback to summary
private boolean sSet
trailerback to summary
private byte trailer
TRAILER_IMPLICITback to summary
public static final byte TRAILER_IMPLICIT

Constructor Detail

PSSSignerback to summary
public PSSSigner(AsymmetricBlockCipher cipher, Digest digest, int sLen)

basic constructor

Parameters
cipher:AsymmetricBlockCipher

the asymmetric cipher to use.

digest:Digest

the digest to use.

sLen:int

the length of the salt to use (in bytes).

PSSSignerback to summary
public PSSSigner(AsymmetricBlockCipher cipher, Digest contentDigest, Digest mgfDigest, int sLen)
PSSSignerback to summary
public PSSSigner(AsymmetricBlockCipher cipher, Digest digest, int sLen, byte trailer)
PSSSignerback to summary
public PSSSigner(AsymmetricBlockCipher cipher, Digest contentDigest, Digest mgfDigest, int sLen, byte trailer)
PSSSignerback to summary
private PSSSigner(AsymmetricBlockCipher cipher, Digest contentDigest1, Digest contentDigest2, Digest mgfDigest, int sLen, byte trailer)
PSSSignerback to summary
public PSSSigner(AsymmetricBlockCipher cipher, Digest digest, byte[] salt)
PSSSignerback to summary
public PSSSigner(AsymmetricBlockCipher cipher, Digest contentDigest, Digest mgfDigest, byte[] salt)
PSSSignerback to summary
public PSSSigner(AsymmetricBlockCipher cipher, Digest contentDigest, Digest mgfDigest, byte[] salt, byte trailer)
PSSSignerback to summary
private PSSSigner(AsymmetricBlockCipher cipher, Digest contentDigest1, Digest contentDigest2, Digest mgfDigest, byte[] salt, byte trailer)

Method Detail

clearBlockback to summary
private void clearBlock(byte[] block)

clear possible sensitive data

createRawSignerback to summary
public static PSSSigner createRawSigner(AsymmetricBlockCipher cipher, Digest contentDigest, Digest mgfDigest, int sLen, byte trailer)
createRawSignerback to summary
public static PSSSigner createRawSigner(AsymmetricBlockCipher cipher, Digest contentDigest, Digest mgfDigest, byte[] salt, byte trailer)
generateSignatureback to summary
public byte[] generateSignature() throws CryptoException, DataLengthException

Implements org.bouncycastle.crypto.Signer.generateSignature.

generate a signature for the message we've been loaded with using the key we were initialised with.

initback to summary
public void init(boolean forSigning, CipherParameters param)

Implements org.bouncycastle.crypto.Signer.init.

Doc from org.bouncycastle.crypto.Signer.init.

Initialise the signer for signing or verification.

Parameters
forSigning:boolean

true if for signing, false otherwise

param:CipherParameters

necessary parameters.

ItoOSPback to summary
private void ItoOSP(int i, byte[] sp)

int to octet string.

maskGeneratorback to summary
private byte[] maskGenerator(byte[] Z, int zOff, int zLen, int length)
maskGeneratorFunction1back to summary
private byte[] maskGeneratorFunction1(byte[] Z, int zOff, int zLen, int length)

mask generator function, as described in PKCS1v2.

resetback to summary
public void reset()

Implements org.bouncycastle.crypto.Signer.reset.

reset the internal state

updateback to summary
public void update(byte b)

Implements org.bouncycastle.crypto.Signer.update.

update the internal digest with the byte b

updateback to summary
public void update(byte[] in, int off, int len)

Implements org.bouncycastle.crypto.Signer.update.

update the internal digest with the byte array in

verifySignatureback to summary
public boolean verifySignature(byte[] signature)

Implements org.bouncycastle.crypto.Signer.verifySignature.

return true if the internal state represents the signature described in the passed in array.