org.xipki.pkcs11.wrapper.params.ByteArrayParams 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.Functions;
import sun.security.pkcs11.wrapper.CK_MECHANISM;
/**
* This class encapsulates parameters byte arrays.
*
* @author Lijun Liao (xipki)
*/
public class ByteArrayParams extends CkParams {
private final byte[] bytes;
public ByteArrayParams(byte[] bytes) {
this.bytes = Functions.requireNonNull("bytes", bytes);
}
@Override
public byte[] getParams() {
return bytes;
}
@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 + "ByteArray Params:\n" + Functions.toString(indent + " ", bytes);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy