use of iaik.pkcs.pkcs11.parameters.InitializationVectorParameters in project xipki by xipki.
the class IaikP11SlotUtil method getMechanism.
// method digestKey0
static Mechanism getMechanism(long mechanism, P11Params parameters) throws P11TokenException {
Mechanism ret = Mechanism.get(mechanism);
if (parameters == null) {
return ret;
}
Parameters paramObj;
if (parameters instanceof P11Params.P11RSAPkcsPssParams) {
P11Params.P11RSAPkcsPssParams param = (P11Params.P11RSAPkcsPssParams) parameters;
paramObj = new RSAPkcsPssParameters(param.getHashAlgorithm(), param.getMaskGenerationFunction(), param.getSaltLength());
} else if (parameters instanceof P11Params.P11ByteArrayParams) {
paramObj = new OpaqueParameters(((P11Params.P11ByteArrayParams) parameters).getBytes());
} else if (parameters instanceof P11Params.P11IVParams) {
paramObj = new InitializationVectorParameters(((P11Params.P11IVParams) parameters).getIV());
} else {
throw new P11TokenException("unknown P11Parameters " + parameters.getClass().getName());
}
ret.setParameters(paramObj);
return ret;
}
Aggregations