Package org.xipki.pkcs11.wrapper
Class Functions
- java.lang.Object
-
- org.xipki.pkcs11.wrapper.Functions
-
public class Functions extends java.lang.ObjectThis class contains only static methods. It is the place for all functions that are used by several classes in this package.- Author:
- Lijun Liao (xipki)
-
-
Constructor Summary
Constructors Constructor Description Functions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]asUnsignedByteArray(java.math.BigInteger bn)static byte[]decodeHex(java.lang.String encoded)static java.lang.StringdecodeOid(byte[] encoded)static java.lang.StringgetCurveName(byte[] ecParams)static java.lang.String[]getCurveNames(byte[] ecParams)static java.lang.IntegergetCurveOrderBitLength(byte[] ecParams)static byte[]getEcParams(java.math.BigInteger order, java.math.BigInteger baseX)static byte[]getOctetsFromASN1OctetString(byte[] encoded)static intrequireAmong(java.lang.String name, int argument, int... candidates)static longrequireAmong(java.lang.String name, long argument, long... candidates)static <T> TrequireNonNull(java.lang.String paramName, T param)static intrequireRange(java.lang.String name, int argument, int min, int max)static java.lang.StringtoFullHex(long value)Converts a long value to a hexadecimal String of length 16.static java.lang.StringtoHex(byte[] value)Converts a byte array to a hexadecimal String.static java.lang.StringtoHex(byte[] value, int ofs, int len)static byte[]toOctetString(byte[] bytes)static java.lang.StringtoString(java.lang.String prefix, byte[] bytes)static java.lang.StringtoStringFlags(PKCS11Constants.Category category, java.lang.String prefix, long flags, long... flagMasks)
-
-
-
Method Detail
-
asUnsignedByteArray
public static byte[] asUnsignedByteArray(java.math.BigInteger bn)
-
toFullHex
public static java.lang.String toFullHex(long value)
Converts a long value to a hexadecimal String of length 16. Includes leading zeros if necessary.- Parameters:
value- The long value to be converted.- Returns:
- The hexadecimal string representation of the long value.
-
toHex
public static java.lang.String toHex(byte[] value)
Converts a byte array to a hexadecimal String. Each byte is presented by its two digit hex-code; 0x0A -> "0a", 0x00 -> "00". No leading "0x" is included in the result.- Parameters:
value- the byte array to be converted- Returns:
- the hexadecimal string representation of the byte array
-
toHex
public static java.lang.String toHex(byte[] value, int ofs, int len)
-
decodeHex
public static byte[] decodeHex(java.lang.String encoded)
-
requireNonNull
public static <T> T requireNonNull(java.lang.String paramName, T param)
-
requireRange
public static int requireRange(java.lang.String name, int argument, int min, int max)
-
requireAmong
public static int requireAmong(java.lang.String name, int argument, int... candidates)
-
requireAmong
public static long requireAmong(java.lang.String name, long argument, long... candidates)
-
toStringFlags
public static java.lang.String toStringFlags(PKCS11Constants.Category category, java.lang.String prefix, long flags, long... flagMasks)
-
getEcParams
public static byte[] getEcParams(java.math.BigInteger order, java.math.BigInteger baseX)
-
getCurveOrderBitLength
public static java.lang.Integer getCurveOrderBitLength(byte[] ecParams)
-
getCurveName
public static java.lang.String getCurveName(byte[] ecParams)
-
getCurveNames
public static java.lang.String[] getCurveNames(byte[] ecParams)
-
decodeOid
public static java.lang.String decodeOid(byte[] encoded)
-
toString
public static java.lang.String toString(java.lang.String prefix, byte[] bytes)
-
getOctetsFromASN1OctetString
public static byte[] getOctetsFromASN1OctetString(byte[] encoded) throws TokenException- Throws:
TokenException
-
toOctetString
public static byte[] toOctetString(byte[] bytes)
-
-