use of iaik.pkcs.pkcs11.params.OpaqueParams in project xipki by xipki.
the class IaikP11Slot method getMechanism.
private static Mechanism getMechanism(long mechanism, P11Params parameters) throws P11TokenException {
Mechanism ret = Mechanism.get(mechanism);
if (parameters == null) {
return ret;
}
Params paramObj;
if (parameters instanceof P11RSAPkcsPssParams) {
P11RSAPkcsPssParams param = (P11RSAPkcsPssParams) parameters;
paramObj = new RSAPkcsPssParams(Mechanism.get(param.getHashAlgorithm()), param.getMaskGenerationFunction(), param.getSaltLength());
} else if (parameters instanceof P11ByteArrayParams) {
paramObj = new OpaqueParams(((P11ByteArrayParams) parameters).getBytes());
} else if (parameters instanceof P11IVParams) {
paramObj = new IVParams(((P11IVParams) parameters).getIV());
} else {
throw new P11TokenException("unknown P11Parameters " + parameters.getClass().getName());
}
if (paramObj != null) {
ret.setParams(paramObj);
}
return ret;
}
Aggregations