use of iaik.pkcs.pkcs11.Mechanism in project xipki by xipki.
the class IaikP11Slot method singleSign.
private byte[] singleSign(Session session, long mechanism, P11Params parameters, byte[] content, IaikP11Identity identity) throws P11TokenException {
Key signingKey = identity.getSigningKey();
Mechanism mechanismObj = getMechanism(mechanism, parameters);
if (LOG.isTraceEnabled()) {
LOG.debug("sign with signing key:\n{}", signingKey);
}
byte[] signature;
try {
session.signInit(mechanismObj, signingKey);
signature = session.sign(content);
} catch (TokenException ex) {
throw new P11TokenException(ex.getMessage(), ex);
}
if (LOG.isDebugEnabled()) {
LOG.debug("signature:\n{}", hex(signature));
}
return signature;
}
Aggregations