public class JPKICryptJNI
extends java.lang.Object
try { JPKICryptJNI jpkiCrypt = new JPKICryptJNI(); jpkiCrypt.method(param); } catch (JPKICryptJNIException e) { // 機能特有の例外 switch (e.getErrorCode()) { case JPKICryptJNIException.JPKI_ERR_PARAM : //引数エラー break; case JPKICryptJNIException.JPKI_ERR_WINDOWS : //Windowsエラー switch (e.getWinErrorCode()) { case JPKICryptJNIException.JPKI_WIN_ERR_NO_MEMORY : break; // その他処理するエラーコードを記述 default : // 予期しないWindowsエラー break; } } } catch (Exception e) { // その他の例外 }
修飾子とタイプ | フィールドと説明 |
---|---|
static int |
JPKI_CALG_SHA_256
cryptCreateHashで、ハッシュアルゴリズム「SHA256」を利用する場合に指定します。
|
static int |
JPKI_CALG_SHA1
cryptCreateHashで、ハッシュアルゴリズム「SHA1」を利用する場合に指定します。
|
static int |
JPKI_VERIFYCONTEXT
cryptAcquireContextで、認証を行なわない場合に指定します。
|
static int |
JPKI_VERYFYCONTEXT
cryptAcquireContextで、認証を行なわない場合に指定します。
|
コンストラクタと説明 |
---|
JPKICryptJNI()
JPKICryptJNIクラスを生成します。
|
修飾子とタイプ | メソッドと説明 |
---|---|
int |
certCreateCertificateContext(byte[] certValue)
証明書に対する証明書ハンドルを返す。
|
void |
certFreeCertificateContext(int hCert)
証明書ハンドルを解放します。
|
byte[] |
certGetPublicKeyInfo(int hCert)
証明書の公開鍵情報を取得します。
|
int |
cryptAcquireContext(int flag)
プロバイダハンドルを取得します。
|
int |
cryptCreateHash(int hProv)
ハッシュオブジェクトを生成しハッシュハンドルを返します。
|
int |
cryptCreateHash(int hProv,
int algid)
ハッシュオブジェクトを生成しハッシュハンドルを返します。
|
void |
cryptDestroyHash(int hHash)
ハッシュオブジェクトを解放します。
|
void |
cryptDestroyKey(int hKey)
鍵ハンドルを解放します。
|
byte[] |
cryptGetCertificateValue(int hKey)
秘密鍵に対応する利用者証明書を取得します。
|
byte[] |
cryptGetHashValue(int hHash)
ハッシュオブジェクトからハッシュ値を取得します。
|
byte[] |
cryptGetRootCertificateValue(int hProv)
都道府県知事の自己署名証明書を取得します。
|
int |
cryptGetUserKey(int hProv)
プロバイダの秘密鍵ハンドルを取得します。
|
void |
cryptHashData(int hHash,
byte[] data)
ハッシュオブジェクトにデータを与えハッシュ値を計算します。
|
int |
cryptImportPublicKey(int hProv,
byte[] publicKeyInfo)
公開鍵への鍵ハンドルを生成します。
|
void |
cryptReleaseContext(int hProv)
プロバイダハンドルを解放します。
|
void |
cryptSetHashValue(int hHash,
byte[] data)
ハッシュオブジェクトにハッシュ値を設定します。
|
byte[] |
cryptSignHash(int hHash)
ハッシュオブジェクトに署名します。
|
boolean |
cryptVerifySignature(int hHash,
byte[] signature,
int hPubKey)
署名をハッシュオブジェクト、公開鍵を用いて検証します。
|
public static final int JPKI_CALG_SHA_256
public static final int JPKI_CALG_SHA1
public static final int JPKI_VERYFYCONTEXT
public static final int JPKI_VERIFYCONTEXT
public JPKICryptJNI()
java.lang.UnsatisfiedLinkError
- - DLLが存在しない場合public int cryptAcquireContext(int flag) throws JPKICryptJNIException
flag
- 動作に関するフラグJPKICryptJNIException
public void cryptReleaseContext(int hProv) throws JPKICryptJNIException
hProv
- プロバイダハンドルJPKICryptJNIException
public int certCreateCertificateContext(byte[] certValue) throws JPKICryptJNIException
certValue
- 証明書(DER形式)JPKICryptJNIException
public void certFreeCertificateContext(int hCert) throws JPKICryptJNIException
hCert
- 証明書ハンドルJPKICryptJNIException
public byte[] certGetPublicKeyInfo(int hCert) throws JPKICryptJNIException
hCert
- 証明書ハンドルJPKICryptJNIException
public int cryptImportPublicKey(int hProv, byte[] publicKeyInfo) throws JPKICryptJNIException
hProv
- プロバイダハンドルpublicKeyInfo
- 公開鍵情報JPKICryptJNIException
public int cryptGetUserKey(int hProv) throws JPKICryptJNIException
hProv
- プロバイダハンドルJPKICryptJNIException
public void cryptDestroyKey(int hKey) throws JPKICryptJNIException
hKey
- 鍵ハンドルJPKICryptJNIException
public byte[] cryptGetCertificateValue(int hKey) throws JPKICryptJNIException
hKey
- 秘密鍵ハンドルJPKICryptJNIException
public byte[] cryptGetRootCertificateValue(int hProv) throws JPKICryptJNIException
hProv
- プロバイダハンドルJPKICryptJNIException
public int cryptCreateHash(int hProv) throws JPKICryptJNIException
hProv
- プロバイダハンドルJPKICryptJNIException
public int cryptCreateHash(int hProv, int algid) throws JPKICryptJNIException
hProv
- プロバイダハンドルalgid
- 利用するハッシュアルゴリズムJPKICryptJNIException
public void cryptHashData(int hHash, byte[] data) throws JPKICryptJNIException
hHash
- ハッシュハンドルdata
- ハッシュするデータJPKICryptJNIException
public byte[] cryptGetHashValue(int hHash) throws JPKICryptJNIException
hHash
- ハッシュハンドルJPKICryptJNIException
public void cryptSetHashValue(int hHash, byte[] data) throws JPKICryptJNIException
hHash
- ハッシュハンドルdata
- ハッシュ値JPKICryptJNIException
public byte[] cryptSignHash(int hHash) throws JPKICryptJNIException
cryptCreateHash(int)
を使用した場合はcryptCreateHash(int,int)
を使用した場合は、指定した以下のアルゴリズムに対応します。hHash
- ハッシュハンドルJPKICryptJNIException
public void cryptDestroyHash(int hHash) throws JPKICryptJNIException
hHash
- ハッシュハンドルJPKICryptJNIException
public boolean cryptVerifySignature(int hHash, byte[] signature, int hPubKey) throws JPKICryptJNIException
hHash
- ハッシュハンドルsignature
- 署名値hPubKey
- 公開鍵ハンドルJPKICryptJNIException