org.xipki.pkcs11.wrapper.params.MechanismParams Maven / Gradle / Ivy
The newest version!
// Copyright (c) 2022 xipki. All rights reserved.
// License Apache License 2.0
package org.xipki.pkcs11.wrapper.params;
import org.xipki.pkcs11.wrapper.PKCS11Constants;
import sun.security.pkcs11.wrapper.CK_MECHANISM;
/**
* This class encapsulates parameters CK_LONG.
*
* @author Lijun Liao (xipki)
*/
public class MechanismParams extends CkParams {
/**
* The PKCS#11 object.
*/
protected final long params;
/**
* Create a new ObjectHandleParameters object using the given object.
*
* @param params
* The params.
*/
public MechanismParams(long params) {
this.params = params;
}
@Override
public Long getParams() {
if (module == null) {
return params;
}
return module.genericToVendorCode(PKCS11Constants.Category.CKM, params);
}
@Override
public CK_MECHANISM toCkMechanism(long mechanism) {
return new CK_MECHANISM(mechanism, getParams());
}
@Override
protected int getMaxFieldLen() {
return 0;
}
@Override
public String toString(String indent) {
return indent + "MechanismParams Params: " + codeToName(PKCS11Constants.Category.CKM, params);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy