All pastes #952013 Raw Edit

jpki sample code

public java v1 · immutable
#952013 ·published 2008-03-21 20:49 UTC
rendered paste body
import jp.go.jpki.appli.JPKICryptJNI;import jp.go.jpki.appli.JPKIUserCertService;import jp.go.jpki.appli.JPKIUserCertBasicData;class test {    public static void main(String[] args) throws Exception {        JPKICryptJNI jpki = new JPKICryptJNI();        int prov_hdl = jpki.cryptAcquireContext(0);        try {            int key_hdl = jpki.cryptGetUserKey(prov_hdl);            try {                final byte[] blob = jpki.cryptGetCertificateValue(key_hdl);                JPKIUserCertService srv = new JPKIUserCertService(blob);                JPKIUserCertBasicData udata = srv.getBasicData();                System.out.println(udata.getAddress());                System.out.println(udata.getDateOfBirth());                System.out.println(udata.getGender());                System.out.println(udata.getName());            } finally {                jpki.cryptDestroyKey(key_hdl);            }        } finally {            jpki.cryptReleaseContext(prov_hdl);        }    }}