List of usage examples for org.bouncycastle.crypto.signers PSSSigner generateSignature
public byte[] generateSignature() throws CryptoException, DataLengthException
From source file:dorkbox.util.crypto.CryptoRSA.java
License:Apache License
/** * RSA sign data with a specified key.//from w w w . ja v a 2 s.c o m * * @param logger * may be null, if no log output is necessary * * @return empty byte[] if error */ public static byte[] sign(PSSSigner signer, RSAPrivateCrtKeyParameters rsaPrivateKey, byte[] mesg, Logger logger) { signer.init(true, rsaPrivateKey); signer.update(mesg, 0, mesg.length); try { return signer.generateSignature(); } catch (Exception e) { if (logger != null) { logger.error("Unable to perform RSA cipher.", e); } return new byte[0]; } }