public class Pkcs11Wrapper extends Object
| Constructor and Description |
|---|
Pkcs11Wrapper() |
| Modifier and Type | Method and Description |
|---|---|
long |
cleanCardWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin)
Wrapper for native method for clearing card by deleting all object from token
|
long |
createCSRWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin,
byte[] publicKeyId,
byte[] privateKeyId,
String[] dn,
String[] attr,
String[] ext,
List<Byte> buffer)
Wrapper for native method to create CSR in PKCS#10 format (C_ISBC_CreateCSR from PKCS#11 API)
|
long |
generateGostR3410_2001KeyPairWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin,
String label,
byte[] id)
Wrapper for native method to generate GOST R 34.10-2001 key pair (C_GenerateKeyPair from PKCS#11 API)
|
long |
generateKeyPairWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin,
long modulusBits,
String label,
byte[] id)
Wrapper for native method to generate RSA key pair (C_GenerateKeyPair from PKCS#11 API)
|
long |
getPublicKeyWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin,
String label,
byte[] id,
List<Byte> modulusData,
List<Byte> exponentData)
Wrapper for native method to generate RSA key pair (C_GenerateKeyPair from PKCS#11 API)
|
long |
getTokenInfoWrap(javax.smartcardio.CardTerminal term,
String moduleName,
String[] label,
String[] manufacturerID,
String[] model,
String[] serialNumber,
String[] flags)
Wrapper for native method to token info (C_GetTokenInfo from PKCS#11 API)
|
long |
getX509CertificateWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin,
String label,
byte[] id,
List<Byte> buffer)
Wrapper for native method to load certificate in x509 format
|
long |
initCardWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin)
Wrapper for native method to initialize token (C_InitToken from PKCS#11 API)
|
long |
listObjectsWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin,
List<Pkcs11ObjectAttribute> attrList)
Wrapper for native method to list token's objects
|
long |
loadCertWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] buffer,
byte[] pass,
byte[] pin)
Wrapper for native method for loading certificate from pfx or p12 file by specify PKCS#11 module path and name
|
long |
loadX509CertificateWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin,
String label,
byte[] id,
byte[] buffer)
Wrapper for native method to load X509 certificate (C_ISBC_ImportX509Certificate from PKCS#11 API)
|
long |
pkcs7SignWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin,
byte[] data,
byte[] signCertId,
byte[] privateKeyId,
byte[][] moreCert,
long flag,
List<Byte> buffer)
Wrapper for native method to sign data in PKCS#7 format (C_ISBC_pkcs7Sign from PKCS#11 API)
|
long |
pkcs7VerifyWrap(String moduleName,
byte[] pkcs7Data,
byte[] data)
Wrapper for native method to verify data in PKCS#7 format (C_ISBC_pkcs7Verify from PKCS#11 API)
|
long |
setPinWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] oldpin,
byte[] newpin)
Wrapper for native method to set user PIN (C_SetPIN from PKCS#11 API)
|
long |
setPukWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] oldpin,
byte[] newpin)
Wrapper for native method to set SO PIN (C_SetPIN from PKCS#11 API)
|
public long loadCertWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] buffer,
byte[] pass,
byte[] pin)
term - reader object or null for any suitable readermoduleName - Path and name for PKCS#11 modulebuffer - buffer with certificate datapass - password for loaded filepin - User PIN for the tokenErrorCodepublic long cleanCardWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin)
term - reader object or null for any suitable readermoduleName - Path and name for PKCS#11 modulepin - User PIN for the tokenErrorCodepublic long initCardWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin)
term - reader object or null for any suitable readermoduleName - Path and name for PKCS#11 modulepin - User PIN for the tokenErrorCodepublic long listObjectsWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin,
List<Pkcs11ObjectAttribute> attrList)
term - reader object or null for any suitable readermoduleName - Path and name for PKCS#11 modulepin - User PIN for the tokenattrList - List of object attributesErrorCodepublic long setPinWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] oldpin,
byte[] newpin)
term - reader object or null for any suitable readermoduleName - Path and name for PKCS#11 moduleoldpin - Old PIN for the tokennewpin - New PIN for the tokenErrorCodepublic long setPukWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] oldpin,
byte[] newpin)
term - reader object or null for any suitable readermoduleName - Path and name for PKCS#11 moduleoldpin - Old PIN for the tokennewpin - New PIN for the tokenErrorCodepublic long generateKeyPairWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin,
long modulusBits,
String label,
byte[] id)
term - reader object or null for any suitable readermoduleName - Path and name for PKCS#11 modulepin - User PIN for the tokenmodulusBits - Number of bits for RSA pairlabel - Object labelid - Object IDErrorCodepublic long getX509CertificateWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin,
String label,
byte[] id,
List<Byte> buffer)
term - reader object or null for any suitable readermoduleName - Path and name for PKCS#11 modulepin - User PIN for the tokenlabel - Object labelid - Object IDbuffer - Buffer with certificate content in DER formatErrorCodepublic long getPublicKeyWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin,
String label,
byte[] id,
List<Byte> modulusData,
List<Byte> exponentData)
term - reader object or null for any suitable readermoduleName - Path and name for PKCS#11 modulepin - User PIN for the tokenlabel - Object labelid - Object IDmodulusData - Buffer with modules data for the public keyexponentData - Buffer with exponent data for the public keyErrorCodepublic long loadX509CertificateWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin,
String label,
byte[] id,
byte[] buffer)
term - reader object or null for any suitable readermoduleName - Path and name for PKCS#11 modulebuffer - Certificate content in DER formatpin - User PIN for the tokenlabel - Object labelid - Object IDErrorCodepublic long createCSRWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin,
byte[] publicKeyId,
byte[] privateKeyId,
String[] dn,
String[] attr,
String[] ext,
List<Byte> buffer)
term - reader object or null for any suitable readermoduleName - Path and name for PKCS#11 modulepin - User PIN for the tokenpublicKeyId - Public key IDprivateKeyId - Private key ID (commonly the same as Public key ID)dn - String array with distinguished name (DN)
Should be send as pair strings.
The first string should be field type or object identified (for example CN)
The second string should contain value in UTF8 formatattr - Additional parameters to be included into CSR.
Format the same as for DNext - Extensions to be included into CSR.
Should be send as triplet strings.
The first string should be field type (for example keyUsage, subjectAltName etc as defined in RFC 3280)
The second string should contain value in UTF8 format
The third string should 0 for non-critical or 1 for critical attributebuffer - Ready CSR content in DER formatErrorCodepublic long pkcs7SignWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin,
byte[] data,
byte[] signCertId,
byte[] privateKeyId,
byte[][] moreCert,
long flag,
List<Byte> buffer)
term - reader object or null for any suitable readermoduleName - Path and name for PKCS#11 modulepin - User PIN for the tokendata - Data to be signedsignCertId - Certificate ID which used for signingprivateKeyId - Private key ID (commonly the same as Certificate ID)moreCert - Array with additional certificatesflag - Special flag, 0 - normal signature, 0x40 - detached signaturebuffer - PKCS#7 signature in DER formatpublic long pkcs7VerifyWrap(String moduleName, byte[] pkcs7Data, byte[] data)
moduleName - Path and name for PKCS#11 modulepkcs7Data - Data in PKCS#7 DER format to be verifieddata - Signed data in case of detached signaturepublic long getTokenInfoWrap(javax.smartcardio.CardTerminal term,
String moduleName,
String[] label,
String[] manufacturerID,
String[] model,
String[] serialNumber,
String[] flags)
term - reader object or null for any suitable readermoduleName - Path and name for PKCS#11 modulelabel - out data for labelmanufacturerID - out data for manufacturerIDmodel - out data for modelserialNumber - out data for serialNumberflags - String with flags represented as ULONG value converted to hex string
See PKCS #11 v2.30 specification for flags descriptionpublic long generateGostR3410_2001KeyPairWrap(javax.smartcardio.CardTerminal term,
String moduleName,
byte[] pin,
String label,
byte[] id)
term - reader object or null for any suitable readermoduleName - Path and name for PKCS#11 modulepin - User PIN for the tokenlabel - Object labelid - Object IDErrorCodeCopyright © 2018. All rights reserved.