示例#1
0
  protected byte[] engineSign() throws SignatureException {
    byte[] hash = new byte[digest.getDigestSize()];

    digest.doFinal(hash, 0);

    try {
      BigInteger[] sig = signer.generateSignature(hash);

      return encoder.encode(sig[0], sig[1]);
    } catch (Exception e) {
      throw new SignatureException(e.toString());
    }
  }
示例#2
0
  protected boolean engineVerify(byte[] sigBytes) throws SignatureException {
    byte[] hash = new byte[digest.getDigestSize()];

    digest.doFinal(hash, 0);

    BigInteger[] sig;

    try {
      sig = encoder.decode(sigBytes);
    } catch (Exception e) {
      throw new SignatureException("error decoding signature bytes.");
    }

    return signer.verifySignature(hash, sig[0], sig[1]);
  }