Search in sources :

Example 1 with InitializationVectorParameters

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;
}
Also used : InitializationVectorParameters(iaik.pkcs.pkcs11.parameters.InitializationVectorParameters) RSAPkcsPssParameters(iaik.pkcs.pkcs11.parameters.RSAPkcsPssParameters) OpaqueParameters(iaik.pkcs.pkcs11.parameters.OpaqueParameters) InitializationVectorParameters(iaik.pkcs.pkcs11.parameters.InitializationVectorParameters) Parameters(iaik.pkcs.pkcs11.parameters.Parameters) RSAPkcsPssParameters(iaik.pkcs.pkcs11.parameters.RSAPkcsPssParameters) P11TokenException(org.xipki.security.pkcs11.P11TokenException) P11Params(org.xipki.security.pkcs11.P11Params) Mechanism(iaik.pkcs.pkcs11.Mechanism) OpaqueParameters(iaik.pkcs.pkcs11.parameters.OpaqueParameters)

Aggregations

Mechanism (iaik.pkcs.pkcs11.Mechanism)1 InitializationVectorParameters (iaik.pkcs.pkcs11.parameters.InitializationVectorParameters)1 OpaqueParameters (iaik.pkcs.pkcs11.parameters.OpaqueParameters)1 Parameters (iaik.pkcs.pkcs11.parameters.Parameters)1 RSAPkcsPssParameters (iaik.pkcs.pkcs11.parameters.RSAPkcsPssParameters)1 P11Params (org.xipki.security.pkcs11.P11Params)1 P11TokenException (org.xipki.security.pkcs11.P11TokenException)1