com.dyadicsec.cryptoki.CKR_Exception Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unbound-java-provider Show documentation
Show all versions of unbound-java-provider Show documentation
This is a collection of JAVA libraries that implement Unbound cryptographic classes for JAVA provider, PKCS11 wrapper, cryptoki, and advapi
package com.dyadicsec.cryptoki;
public class CKR_Exception extends java.lang.Exception
{
public int errorCode;
public String functionName;
public String getMessage()
{
if (functionName==null) return "Library errorCode=0x" + Integer.toHexString(errorCode);
return "Library." + functionName + " failed, errorCode=0x" + Integer.toHexString(errorCode);
}
CKR_Exception(int errorCode, java.lang.Exception src) {
super(src);
this.errorCode = errorCode;
}
CKR_Exception(int errorCode) {
this.errorCode = errorCode;
}
CKR_Exception(int errorCode, String functionName) {
this.errorCode = errorCode;
}
static void check(long rv) throws CKR_Exception
{
int errorCode = (int)(rv>>32);
if (errorCode!=0) throw new CKR_Exception(errorCode);
}
static void check(long rv, String function) throws CKR_Exception
{
int errorCode = (int)(rv>>32);
if (errorCode!=0) throw new CKR_Exception(errorCode, function);
}
}