Ejemplo n.º 1
0
 /**
  * Initialize the signer.
  *
  * @param forSigning Whether to initialize signer for the sign operation.
  * @param params BC cipher parameters.
  */
 protected void init(final boolean forSigning, final CipherParameters params) {
   if (forSigning && randomProvider != null) {
     signer.init(forSigning, new ParametersWithRandom(params, randomProvider));
   } else {
     signer.init(forSigning, params);
   }
 }
Ejemplo n.º 2
0
 /** {@inheritDoc} */
 public boolean verify(final InputStream in, final byte[] signature)
     throws CryptException, IOException {
   final BigInteger[] sig = decode(signature);
   return signer.verifySignature(digest.digest(in), sig[0], sig[1]);
 }
Ejemplo n.º 3
0
 /** {@inheritDoc} */
 public byte[] sign(final InputStream in) throws CryptException, IOException {
   final BigInteger[] out = signer.generateSignature(digest.digest(in));
   return encode(out[0], out[1]);
 }
Ejemplo n.º 4
0
 /** {@inheritDoc} */
 public boolean verify(final byte[] data, final byte[] signature) throws CryptException {
   final BigInteger[] sig = decode(signature);
   return signer.verifySignature(digest.digest(data), sig[0], sig[1]);
 }
Ejemplo n.º 5
0
 /** {@inheritDoc} */
 public byte[] sign(final byte[] data) throws CryptException {
   final BigInteger[] out = signer.generateSignature(digest.digest(data));
   return encode(out[0], out[1]);
 }