public class JPKICryptSignJNI
extends java.lang.Object
try { JPKICryptSignJNI jpkiCryptSign = new JPKICryptSignJNI(); jpkiCryptSign.method(param); } catch (JPKICryptSignJNIException e) { // 機能特有の例外 switch (e.getErrorCode()) { case JPKICryptSignJNIException.JPKI_ERR_PARAM : //引数エラー break; case JPKICryptSignJNIException.JPKI_ERR_WINDOWS : //Windowsエラー switch (e.getWinErrorCode()) { case JPKICryptSignJNIException.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で、認証を行なわない場合に指定します。
|
コンストラクタと説明 |
---|
JPKICryptSignJNI()
JPKICryptSignJNIクラスを生成します。
|
修飾子とタイプ | メソッドと説明 |
---|---|
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_VERIFYCONTEXT
public JPKICryptSignJNI()
java.lang.UnsatisfiedLinkError
- - DLLが存在しない場合public int cryptAcquireContext(int flag) throws JPKICryptSignJNIException
flag
- 動作に関するフラグJPKICryptSignJNIException
public void cryptReleaseContext(int hProv) throws JPKICryptSignJNIException
hProv
- プロバイダハンドルJPKICryptSignJNIException
public int certCreateCertificateContext(byte[] certValue) throws JPKICryptSignJNIException
certValue
- 証明書(DER形式)JPKICryptSignJNIException
public void certFreeCertificateContext(int hCert) throws JPKICryptSignJNIException
hCert
- 証明書ハンドルJPKICryptSignJNIException
public byte[] certGetPublicKeyInfo(int hCert) throws JPKICryptSignJNIException
hCert
- 証明書ハンドルJPKICryptSignJNIException
public int cryptImportPublicKey(int hProv, byte[] publicKeyInfo) throws JPKICryptSignJNIException
hProv
- プロバイダハンドルpublicKeyInfo
- 公開鍵情報JPKICryptSignJNIException
public int cryptGetUserKey(int hProv) throws JPKICryptSignJNIException
hProv
- プロバイダハンドルJPKICryptSignJNIException
public void cryptDestroyKey(int hKey) throws JPKICryptSignJNIException
hKey
- 鍵ハンドルJPKICryptSignJNIException
public byte[] cryptGetCertificateValue(int hKey) throws JPKICryptSignJNIException
hKey
- 秘密鍵ハンドルJPKICryptSignJNIException
public byte[] cryptGetRootCertificateValue(int hProv) throws JPKICryptSignJNIException
hProv
- プロバイダハンドルJPKICryptSignJNIException
public int cryptCreateHash(int hProv) throws JPKICryptSignJNIException
hProv
- プロバイダハンドルJPKICryptSignJNIException
public int cryptCreateHash(int hProv, int algid) throws JPKICryptSignJNIException
hProv
- プロバイダハンドルalgid
- 利用するハッシュアルゴリズムJPKICryptSignJNIException
public void cryptHashData(int hHash, byte[] data) throws JPKICryptSignJNIException
hHash
- ハッシュハンドルdata
- ハッシュするデータJPKICryptSignJNIException
public byte[] cryptGetHashValue(int hHash) throws JPKICryptSignJNIException
hHash
- ハッシュハンドルJPKICryptSignJNIException
public void cryptSetHashValue(int hHash, byte[] data) throws JPKICryptSignJNIException
hHash
- ハッシュハンドルdata
- ハッシュ値JPKICryptSignJNIException
public byte[] cryptSignHash(int hHash) throws JPKICryptSignJNIException
cryptCreateHash(int)
を使用した場合はcryptCreateHash(int,int)
を使用した場合は、指定した以下のアルゴリズムに対応します。hHash
- ハッシュハンドルJPKICryptSignJNIException
public void cryptDestroyHash(int hHash) throws JPKICryptSignJNIException
hHash
- ハッシュハンドルJPKICryptSignJNIException
public boolean cryptVerifySignature(int hHash, byte[] signature, int hPubKey) throws JPKICryptSignJNIException
hHash
- ハッシュハンドルsignature
- 署名値hPubKey
- 公開鍵ハンドルJPKICryptSignJNIException