public class SmartCard extends java.lang.Object implements ISmartCard
Modifier and Type | Field and Description |
---|---|
protected boolean |
isFipsEnabled |
protected Application |
mApplication |
protected CardType |
mCardType |
protected long |
mSessionID |
protected long |
mSlotID |
Constructor and Description |
---|
SmartCard(CardType aCardType)
Create smart card with a card type
|
SmartCard(CardType aCardType,
Application aApplication)
Create smart card with a card type and application
|
SmartCard(java.lang.String aCardType)
Create smart card with a card type name
|
SmartCard(java.lang.String aCardTypeName,
java.lang.String smartCardDllName)
Create smart card with a card type
|
Modifier and Type | Method and Description |
---|---|
void |
changeLabel(long aSessionID,
java.lang.String aOldLabel,
java.lang.String aNewLabel)
changeLabel changes all the objects' labels that have aOldLabel with the aNewLabel
|
void |
changePassword(java.lang.String aOldPass,
java.lang.String aNewPass,
long aSessionID)
changePassword changes user's pin.
|
void |
changeUserPin(byte[] aSOPin,
byte[] aUserPin,
long aSessionHandle)
changeUserPin changes user's pin.
|
static void |
checkLicense() |
void |
closeSession(long aSessionID)
closeSession closes the session between the application and the token
|
java.security.spec.KeySpec |
createKeyPair(long aSessionID,
KeyPairTemplate template)
createKeyPair generates public/private key pair according to the given KeyPairTemplate.
|
void |
createKeyPair(long aSessionID,
java.lang.String aKeyLabel,
java.security.spec.AlgorithmParameterSpec aParamSpec,
boolean aIsSign,
boolean aIsEncrypt)
createKeyPair generates public/private key pair according to the given parameters.
|
void |
createSecretKey(long aSessionID,
SecretKey aKey)
createSecretKey creates secret key
|
void |
createSecretKey(long sessionID,
SecretKeyTemplate template)
Create SecretKey specified with SecretKeyTemplate
|
byte[] |
decodeSignatureIfItIsEC(long aSessionID,
java.lang.String aKeyLabel,
sun.security.pkcs11.wrapper.CK_MECHANISM mech,
byte[] aSignature)
Utimaco, NCipher ve Atik yalın halde imza bekliyor.
|
byte[] |
decryptData(long aSessionID,
java.lang.String aKeyLabel,
byte[] aData,
sun.security.pkcs11.wrapper.CK_MECHANISM aMechanism)
decryptData finds the private key with given label and decrypts data.
|
byte[] |
decryptData(long aSessionID,
java.lang.String aKeyLabel,
byte[] aData,
long aMechanism)
Deprecated.
|
byte[] |
decryptDataWithCertSerialNo(long aSessionID,
byte[] aSerialNumber,
sun.security.pkcs11.wrapper.CK_MECHANISM aMechanism,
byte[] aData)
decryptDataWithCertSerialNo finds the private key that has the same CKA_ID value with the certificate having the given serial number
and decrypts the given encrypted data.
|
byte[] |
decryptDataWithCertSerialNo(long aSessionID,
byte[] aSerialNumber,
long aMechanism,
byte[] aData)
Deprecated.
|
int |
deleteCertificate(long aSessionID,
java.lang.String aKeyLabel)
Delete certificate with given key label
|
void |
deletePrivateData(long aSessionID,
java.lang.String aLabel)
deletePrivateData finds the object/s (type CKO_DATA) with the given label and deletes it/them.
|
void |
deletePrivateObject(long aSessionID,
java.lang.String aLabel)
deletePrivateObject finds the object/s (type can be anything) with the given label and deletes it/them.
|
void |
deletePublicData(long aSessionID,
java.lang.String aLabel)
deletePublicData finds the object/s (type CKO_DATA) with the given label and deletes it/them.
|
void |
deletePublicObject(long aSessionID,
java.lang.String aLabel)
deletePublicObject finds the object/s (type can be anything) with the given label and deletes it/them.
|
byte[] |
encryptData(long aSessionID,
java.lang.String aKeyLabel,
byte[] aData,
sun.security.pkcs11.wrapper.CK_MECHANISM aMechanism)
encryptData finds the public key with the given label and encrypts the given data.
|
byte[] |
encryptData(long aSessionID,
java.lang.String aKeyLabel,
byte[] aData,
long aMechanism)
Deprecated.
|
protected static CardType |
findCardType(java.lang.String aATRHex,
Application aApp)
Find and return card type from ATR
|
void |
formatToken(java.lang.String aSOpin,
java.lang.String aNewPIN,
java.lang.String aLabel,
int slotID)
formatToken changes user's pin and formats the token.
|
java.security.KeyPair |
generateECKeyPair(long aSessionID,
java.security.spec.ECParameterSpec ecParameterSpec) |
byte[] |
generateRSAPrivateKey(long aSessionID,
int keySize)
generateRSAPrivateKey generates RSA Private Key in the Asn1 format.
|
Application |
getApplication() |
void |
getAttributeValue(long aSessionID,
long aObjectID,
sun.security.pkcs11.wrapper.CK_ATTRIBUTE[] aTemplate) |
CardType |
getCardType()
Return card type
|
java.util.List<byte[]> |
getCertificates(long aSessionID) |
java.util.List<byte[]> |
getEncryptionCertificates(long aSessionID)
getEncryptionCertificates returns encryption certificates.
|
java.lang.String[] |
getEncryptionKeyLabels(long aSessionID)
getEncryptionKeyLabels returns labels of encryption keys.
|
CardType |
getKartTipi()
Return card type
|
long |
getLatestSessionID() |
long |
getLatestSlotID() |
long[] |
getMechanismList(long aSlotID)
getMechanismList returns list of mechanism types supported by the token present in the given slot
|
byte[] |
getModulusOfKey(long aSessionID,
long aObjID) |
sun.security.pkcs11.wrapper.PKCS11 |
getPKCS11() |
long |
getPrivateKeyObjIDFromCertificateSerial(long aSessionID,
byte[] aCertSerialNo)
return Private Key Object ID from Certificate Serial
|
long |
getPrivateKeyObjIDFromPrivateKeyLabel(long aSessionID,
java.lang.String aLabel)
return Private Key Object ID from Private Key label
|
long |
getPublicKeyObjIDFromPublicKeyLabel(long aSessionID,
java.lang.String aLabel) |
byte[] |
getRandomData(long aSessionID,
int aDataLength)
getRandomData generates random data
|
sun.security.pkcs11.wrapper.CK_SESSION_INFO |
getSessionInfo(long aSessionID)
getSessionInfo returns information about the session with the given id
|
java.util.List<byte[]> |
getSignatureCertificates(long aSessionID)
getSignatureCertificates returns signing certificates.(Searches for keyusage with digitalSignature bit set)
|
java.lang.String[] |
getSignatureKeyLabels(long aSessionID)
getSignatureKeyLabels returns labels of signing keys.
|
sun.security.pkcs11.wrapper.CK_SLOT_INFO |
getSlotInfo(long aSlotID)
getSlotInfo returns information about the slot with the given id
|
java.util.List<SlotInfo> |
getSlotInfoList() |
long[] |
getSlotList()
getSlotList returns list of slot handles
|
sun.security.pkcs11.wrapper.CK_TOKEN_INFO |
getTokenInfo(long aSlotID)
getTokenInfo returns information about the token present in the given slot
|
long[] |
getTokenPresentSlotList()
getTokenPresentSlotList returns list of slot handles that has token present
|
java.util.List<tr.gov.tubitak.uekae.esya.api.common.util.bag.Pair<java.lang.Long,java.lang.String>> |
getTokenPresentSlotListWithDescription() |
byte[] |
getTokenSerialNo(long aSlotID)
getTokenSerialNo returns token's serial number.
|
java.lang.String[] |
getUnwrapperKeyLabels(long aSessionID)
getUnwrapperKeyLabels returns labels of unwrapper keys.
|
java.lang.String[] |
getWrapperKeyLabels(long aSessionID)
getWrapperKeyLabels returns labels of wrapper keys.
|
void |
importCertificate(long aSessionID,
java.lang.String aCertLabel,
java.security.cert.X509Certificate aSertifika)
importCertificate imports the given certificate to the token with the given label.
|
void |
importCertificateAndKey(long aSessionID,
java.lang.String aCertLabel,
java.lang.String aKeyLabel,
java.security.PrivateKey aPrivKey,
java.security.cert.X509Certificate aCert)
importCertificateAndKey imports private key, certificate and public key extracted from certificate to the card.
|
boolean |
importCertificateAndKeyWithCSP(byte[] aAnahtarCifti,
int aAnahtarLen,
java.lang.String aScfname,
java.lang.String aContextName,
byte[] aPbCertificate,
int aSignOrEnc) |
boolean |
importCertificateAndKeyWithCSP(byte[] aAnahtarCifti,
int aAnahtarLen,
java.lang.String aScfname,
java.lang.String aContextName,
java.security.cert.X509Certificate aPbCertificate,
int aSignOrEnc) |
void |
importKeyPair(long sessionID,
KeyPairTemplate template)
Create KeyPair specified with KeyPairTemplate
|
void |
importKeyPair(long aSessionID,
java.lang.String aLabel,
java.security.KeyPair aKeyPair,
byte[] aSubject,
boolean aIsSign,
boolean aIsEncrypt)
Deprecated.
Use importKeyPair(SessionID, KeyPairTemplate)
|
void |
importSecretKey(long aSessionID,
SecretKey aKey)
importSecretKey imports the given secret key to the token
|
void |
importSecretKey(long aSessionID,
SecretKeyTemplate aKeyTemplate) |
boolean |
isAnyObjectExist(long aSessionID)
isAnyObjectExist searches for any type of object and return true if found.
|
boolean |
isCertificateExist(long aSessionID,
java.lang.String aLabel)
isCertificateExist searches for certificate with the given label.
|
boolean |
isFipsModeEnable() |
boolean |
isObjectExist(long aSessionID,
java.lang.String aLabel)
isObjectExist searches for any type of object with the given label and returns true if finds anything.
|
boolean |
isPrivateKeyExist(long aSessionID,
java.lang.String aLabel)
isPrivateKeyExist searches for the private key with the given label.
|
boolean |
isPublicKeyExist(long aSessionID,
java.lang.String aLabel)
isPublicKeyExist searches for public key with the given label and returns true if finds.
|
boolean |
isSupportsWrapUnwrap(long sessionId) |
boolean |
isTokenPresent(long aSlotID)
isTokenPresent checks if token is present in the slot
|
void |
login(long aSessionID,
java.lang.String aCardPIN)
login logs user to the session
|
void |
logout(long aSessionID)
logout logs a user out from a token.
|
long[] |
objeAra(long aSessionID,
sun.security.pkcs11.wrapper.CK_ATTRIBUTE[] aTemplate) |
long |
openSession(long aSlotID)
openSession opens a session between the application and the token present in the given slot.
|
byte[] |
readCertificate(long aSessionID,
byte[] aCertSerialNo)
readCertificate returns certificates that has the given serial number as list.
|
java.util.List<byte[]> |
readCertificate(long aSessionID,
java.lang.String aLabel)
readCertificate returns certificates that has the given label as list.
|
java.util.List<byte[]> |
readPrivateData(long aSessionID,
java.lang.String aLabel)
readPrivateData reads data(type CKO_DATA) from the private area of the card.
|
java.util.List<byte[]> |
readPublicData(long aSessionID,
java.lang.String aLabel)
readPublicData reads data(type CKO_DATA) from the public area of the card.
|
java.security.spec.KeySpec |
readPublicKeySpec(long aSessionID,
byte[] aCertSerialNo)
readPublicKeySpec returns specification of public key that has the same CKA_ID with certificate having the given serial number.
|
java.security.spec.KeySpec |
readPublicKeySpec(long aSessionID,
java.lang.String aLabel)
readPublicKeySpec returns specification of public key with the given label.For now, supported algorithms
are RSA and ECDSA
|
void |
setApplication(Application aApplication)
Sets application in order to change behavior smartcard operations
|
boolean |
setContainer(byte[] aContainerLabel,
long aSessionHandle) |
void |
setFipsMode(boolean mode)
Sets fips mode.
|
void |
setSOPin(byte[] aSOPin,
byte[] aNewSOPin,
long aSessionHandle)
setSOPin changes SO's(Security Officer) pin
|
byte[] |
signAndRecoverData(long aSessionID,
java.lang.String aKeyLabel,
byte[] aToBeSigned,
sun.security.pkcs11.wrapper.CK_MECHANISM aMechanism) |
byte[] |
signData(long aSessionID,
java.lang.String aKeyLabel,
byte[] aToBeSigned,
sun.security.pkcs11.wrapper.CK_MECHANISM aMechanism)
signData finds the private key with the given label and signs the given data.
|
byte[] |
signData(long aSessionID,
java.lang.String aKeyLabel,
byte[] aToBeSigned,
long aMechanism)
Deprecated.
|
byte[] |
signDataWithCertSerialNo(long aSessionID,
byte[] aSerialNumber,
sun.security.pkcs11.wrapper.CK_MECHANISM aMechanism,
byte[] aToBeSigned)
signDataWithCertSerialNo finds the private key that has the same CKA_ID value with the certificate having the given serial number
and signs the given data.
|
byte[] |
signDataWithCertSerialNo(long aSessionID,
byte[] aSerialNumber,
long aMechanism,
byte[] aToBeSigned)
Deprecated.
|
byte[] |
signDataWithKeyID(long aSessionID,
long aKeyID,
sun.security.pkcs11.wrapper.CK_MECHANISM aMechanism,
byte[] aToBeSigned)
Sign byte array with given parameter
|
void |
unwrapKey(long sessionID,
sun.security.pkcs11.wrapper.CK_MECHANISM mechanism,
byte[] certSerialNumber,
byte[] wrappedKey,
KeyTemplate unwrappedKeyTemplate)
Unrap(wrappedKey) keys with unwrapper key(unwrappingKeyLabel) in smartcard with specified mechanism(mechanism), creating key with KeyTemplate(unwrappedKeyTemplate)
|
void |
unwrapKey(long sessionID,
sun.security.pkcs11.wrapper.CK_MECHANISM mechanism,
KeyTemplate unwrapperKeyTemplate,
byte[] wrappedKey,
KeyTemplate unwrappedKeyTemplate)
Unrap(wrappedKey) keys with unwrapper key(unwrappingKeyLabel) in smartcard with specified mechanism(mechanism), creating key with KeyTemplate(unwrappedKeyTemplate)
|
void |
unwrapKey(long sessionID,
sun.security.pkcs11.wrapper.CK_MECHANISM mechanism,
java.lang.String unwrapperKeyLabel,
byte[] wrappedKey,
KeyTemplate unwrappedKeyTemplate)
Unrap(wrappedKey) keys with unwrapper key(unwrappingKeyLabel) in smartcard with specified mechanism(mechanism), creating key with KeyTemplate(unwrappedKeyTemplate)
|
void |
updatePrivateData(long aSessionID,
java.lang.String aLabel,
byte[] aValue)
updatePrivateData finds the data (type CKO_DATA) with the given label and updates it with the given value.
|
void |
updatePublicData(long aSessionID,
java.lang.String aLabel,
byte[] aValue)
updatePublicData finds the data (type CKO_DATA) with the given label and updates it with the given value.
|
byte[] |
verifyAndRecoverData(long aSessionID,
java.lang.String aKeyLabel,
byte[] aSignedData,
sun.security.pkcs11.wrapper.CK_MECHANISM aMechanism) |
void |
verifyData(long aSessionID,
java.lang.String aKeyLabel,
byte[] aData,
byte[] aSignature,
sun.security.pkcs11.wrapper.CK_MECHANISM aMechanism)
verifyData finds the public key and verifies the given signature.
|
void |
verifyData(long aSessionID,
java.lang.String aKeyLabel,
byte[] aData,
byte[] aSignature,
long aMechanism)
verifyData finds the public key and verifies the given signature.
|
byte[] |
wrapKey(long sessionID,
sun.security.pkcs11.wrapper.CK_MECHANISM mechanism,
KeyTemplate wrapperKeyTemplate,
KeyTemplate wrappingKeyTemplate)
Wrap keys in smartcard with specified wrapping key in smartcard.
|
byte[] |
wrapKey(long sessionID,
sun.security.pkcs11.wrapper.CK_MECHANISM mechanism,
java.lang.String wrapperKeyLabel,
java.lang.String labelOfKeyToWrap)
Wrap keys in smartcard with specified wrapping key in smartcard.
|
void |
writePrivateData(long aSessionID,
java.lang.String aLabel,
byte[] aData)
writePrivateData writes(as CKO_DATA) the given data to the token's private area with the given label.
|
void |
writePublicData(long aSessionID,
java.lang.String aLabel,
byte[] aData)
writePublicData writes(as CKO_DATA) the given data to the public area of the card with the given label.
|
protected CardType mCardType
protected Application mApplication
protected boolean isFipsEnabled
protected long mSlotID
protected long mSessionID
public SmartCard(CardType aCardType) throws sun.security.pkcs11.wrapper.PKCS11Exception, java.io.IOException
aCardType
- sun.security.pkcs11.wrapper.PKCS11Exception
java.io.IOException
public SmartCard(CardType aCardType, Application aApplication) throws sun.security.pkcs11.wrapper.PKCS11Exception, java.io.IOException
aCardType
- aApplication
- sun.security.pkcs11.wrapper.PKCS11Exception
java.io.IOException
public SmartCard(java.lang.String aCardTypeName, java.lang.String smartCardDllName) throws sun.security.pkcs11.wrapper.PKCS11Exception, java.io.IOException
aCardTypeName
- smartCardDllName
- sun.security.pkcs11.wrapper.PKCS11Exception
java.io.IOException
public SmartCard(java.lang.String aCardType) throws sun.security.pkcs11.wrapper.PKCS11Exception, java.io.IOException
aCardType
- sun.security.pkcs11.wrapper.PKCS11Exception
java.io.IOException
public void setFipsMode(boolean mode)
mode
- public boolean isFipsModeEnable()
public void setApplication(Application aApplication)
aApplication
- public Application getApplication()
public long[] getTokenPresentSlotList() throws sun.security.pkcs11.wrapper.PKCS11Exception
getTokenPresentSlotList
in interface ISmartCard
sun.security.pkcs11.wrapper.PKCS11Exception
public java.util.List<tr.gov.tubitak.uekae.esya.api.common.util.bag.Pair<java.lang.Long,java.lang.String>> getTokenPresentSlotListWithDescription() throws sun.security.pkcs11.wrapper.PKCS11Exception
getTokenPresentSlotListWithDescription
in interface ISmartCard
sun.security.pkcs11.wrapper.PKCS11Exception
public long[] getSlotList() throws sun.security.pkcs11.wrapper.PKCS11Exception
getSlotList
in interface ISmartCard
sun.security.pkcs11.wrapper.PKCS11Exception
public java.util.List<SlotInfo> getSlotInfoList() throws sun.security.pkcs11.wrapper.PKCS11Exception
sun.security.pkcs11.wrapper.PKCS11Exception
public long getLatestSlotID()
public long getLatestSessionID()
public sun.security.pkcs11.wrapper.CK_SLOT_INFO getSlotInfo(long aSlotID) throws sun.security.pkcs11.wrapper.PKCS11Exception
getSlotInfo
in interface ISmartCard
aSlotID
- slot idsun.security.pkcs11.wrapper.PKCS11Exception
public sun.security.pkcs11.wrapper.CK_SESSION_INFO getSessionInfo(long aSessionID) throws sun.security.pkcs11.wrapper.PKCS11Exception
getSessionInfo
in interface ISmartCard
aSessionID
- session idsun.security.pkcs11.wrapper.PKCS11Exception
public boolean isTokenPresent(long aSlotID) throws sun.security.pkcs11.wrapper.PKCS11Exception
isTokenPresent
in interface ISmartCard
aSlotID
- slot idsun.security.pkcs11.wrapper.PKCS11Exception
public sun.security.pkcs11.wrapper.CK_TOKEN_INFO getTokenInfo(long aSlotID) throws sun.security.pkcs11.wrapper.PKCS11Exception
getTokenInfo
in interface ISmartCard
aSlotID
- slot idsun.security.pkcs11.wrapper.PKCS11Exception
public long[] getMechanismList(long aSlotID) throws sun.security.pkcs11.wrapper.PKCS11Exception
getMechanismList
in interface ISmartCard
aSlotID
- slot idsun.security.pkcs11.wrapper.PKCS11Exception
public long openSession(long aSlotID) throws sun.security.pkcs11.wrapper.PKCS11Exception
openSession
in interface ISmartCard
aSlotID
- slot id of the tokensun.security.pkcs11.wrapper.PKCS11Exception
public void closeSession(long aSessionID) throws sun.security.pkcs11.wrapper.PKCS11Exception
closeSession
in interface ISmartCard
aSessionID
- sun.security.pkcs11.wrapper.PKCS11Exception
public void login(long aSessionID, java.lang.String aCardPIN) throws sun.security.pkcs11.wrapper.PKCS11Exception
login
in interface ISmartCard
aSessionID
- session handleaCardPIN
- pin of the tokensun.security.pkcs11.wrapper.PKCS11Exception
public void logout(long aSessionID) throws sun.security.pkcs11.wrapper.PKCS11Exception
logout
in interface ISmartCard
aSessionID
- session handlesun.security.pkcs11.wrapper.PKCS11Exception
public boolean isAnyObjectExist(long aSessionID) throws sun.security.pkcs11.wrapper.PKCS11Exception
isAnyObjectExist
in interface ISmartCard
aSessionID
- session handlesun.security.pkcs11.wrapper.PKCS11Exception
public void importCertificate(long aSessionID, java.lang.String aCertLabel, java.security.cert.X509Certificate aSertifika) throws sun.security.pkcs11.wrapper.PKCS11Exception
importCertificate
in interface ISmartCard
aSessionID
- session handleaCertLabel
- certificate is imported to the token with this labelaSertifika
- certificatesun.security.pkcs11.wrapper.PKCS11Exception
public void createKeyPair(long aSessionID, java.lang.String aKeyLabel, java.security.spec.AlgorithmParameterSpec aParamSpec, boolean aIsSign, boolean aIsEncrypt) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException, java.io.IOException
createKeyPair
in interface ISmartCard
aSessionID
- session handleaKeyLabel
- keys are generated with this labelaParamSpec
- parameters used for key generation. For RSA, java.security.spec.RSAKeyGenParameterSpec;
for ECDSA java.security.spec.ECParameterSpec or java.security.spec.ECGenParameterSpec type parameters must be supplied.aIsSign
- true if keys are for signing, false otherwiseaIsEncrypt
- true if keys are for encryption, false otherwisesun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
java.io.IOException
public java.security.spec.KeySpec createKeyPair(long aSessionID, KeyPairTemplate template) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException, java.io.IOException
createKeyPair
in interface ISmartCard
aSessionID
- session handle (login reqires)template
- Key Pair template to generate keyssun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
java.io.IOException
RSAKeyPairTemplate
,
ECKeyPairTemplate
public byte[] generateRSAPrivateKey(long aSessionID, int keySize) throws tr.gov.tubitak.uekae.esya.api.common.ESYAException
generateRSAPrivateKey
in interface ISmartCard
aSessionID
- session handlekeySize
- key sizetr.gov.tubitak.uekae.esya.api.common.ESYAException
public java.security.KeyPair generateECKeyPair(long aSessionID, java.security.spec.ECParameterSpec ecParameterSpec) throws tr.gov.tubitak.uekae.esya.api.common.ESYAException
generateECKeyPair
in interface ISmartCard
tr.gov.tubitak.uekae.esya.api.common.ESYAException
@Deprecated public byte[] signDataWithCertSerialNo(long aSessionID, byte[] aSerialNumber, long aMechanism, byte[] aToBeSigned) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
signDataWithCertSerialNo
in interface ISmartCard
aSessionID
- session handleaSerialNumber
- certificate serial numberaMechanism
- mechanism for signingaToBeSigned
- Data to be signedsun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public byte[] signDataWithKeyID(long aSessionID, long aKeyID, sun.security.pkcs11.wrapper.CK_MECHANISM aMechanism, byte[] aToBeSigned) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
signDataWithKeyID
in interface ISmartCard
aSessionID
- aKeyID
- aMechanism
- aToBeSigned
- sun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public byte[] signDataWithCertSerialNo(long aSessionID, byte[] aSerialNumber, sun.security.pkcs11.wrapper.CK_MECHANISM aMechanism, byte[] aToBeSigned) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
signDataWithCertSerialNo
in interface ISmartCard
aSessionID
- session handleaSerialNumber
- certificate serial numberaMechanism
- mechanism for signingaToBeSigned
- Data to be signedsun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
@Deprecated public byte[] decryptDataWithCertSerialNo(long aSessionID, byte[] aSerialNumber, long aMechanism, byte[] aData) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
decryptDataWithCertSerialNo
in interface ISmartCard
aSessionID
- session handleaSerialNumber
- certificate serial numberaMechanism
- mechanism for decryptionaData
- encrypted datasun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public byte[] decryptDataWithCertSerialNo(long aSessionID, byte[] aSerialNumber, sun.security.pkcs11.wrapper.CK_MECHANISM aMechanism, byte[] aData) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
decryptDataWithCertSerialNo
in interface ISmartCard
aSessionID
- session handleaSerialNumber
- certificate serial numberaMechanism
- mechanism for decryptionaData
- encrypted datasun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public java.util.List<byte[]> getCertificates(long aSessionID) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
getCertificates
in interface ISmartCard
sun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public java.util.List<byte[]> getSignatureCertificates(long aSessionID) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
getSignatureCertificates
in interface ISmartCard
aSessionID
- session handlesun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public java.util.List<byte[]> getEncryptionCertificates(long aSessionID) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
getEncryptionCertificates
in interface ISmartCard
aSessionID
- session handlesun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public java.lang.String[] getSignatureKeyLabels(long aSessionID) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
getSignatureKeyLabels
in interface ISmartCard
aSessionID
- session handlesun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public long getPrivateKeyObjIDFromCertificateSerial(long aSessionID, byte[] aCertSerialNo) throws SmartCardException, sun.security.pkcs11.wrapper.PKCS11Exception
getPrivateKeyObjIDFromCertificateSerial
in interface ISmartCard
aSessionID
- session handleaCertSerialNo
- sun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public long getPrivateKeyObjIDFromPrivateKeyLabel(long aSessionID, java.lang.String aLabel) throws SmartCardException, sun.security.pkcs11.wrapper.PKCS11Exception
getPrivateKeyObjIDFromPrivateKeyLabel
in interface ISmartCard
aSessionID
- session handleaLabel
- sun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public long getPublicKeyObjIDFromPublicKeyLabel(long aSessionID, java.lang.String aLabel) throws SmartCardException, sun.security.pkcs11.wrapper.PKCS11Exception
getPublicKeyObjIDFromPublicKeyLabel
in interface ISmartCard
SmartCardException
sun.security.pkcs11.wrapper.PKCS11Exception
public java.lang.String[] getEncryptionKeyLabels(long aSessionID) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
getEncryptionKeyLabels
in interface ISmartCard
aSessionID
- session handlesun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public java.lang.String[] getWrapperKeyLabels(long aSessionID) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
getWrapperKeyLabels
in interface ISmartCard
aSessionID
- session handlesun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public java.lang.String[] getUnwrapperKeyLabels(long aSessionID) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
getUnwrapperKeyLabels
in interface ISmartCard
aSessionID
- session handlesun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public boolean isObjectExist(long aSessionID, java.lang.String aLabel) throws sun.security.pkcs11.wrapper.PKCS11Exception
isObjectExist
in interface ISmartCard
aSessionID
- session handleaLabel
- label of the searched objectsun.security.pkcs11.wrapper.PKCS11Exception
public void writePrivateData(long aSessionID, java.lang.String aLabel, byte[] aData) throws sun.security.pkcs11.wrapper.PKCS11Exception
writePrivateData
in interface ISmartCard
aSessionID
- session handleaLabel
- label to be given to dataaData
- data to be writtensun.security.pkcs11.wrapper.PKCS11Exception
public void writePublicData(long aSessionID, java.lang.String aLabel, byte[] aData) throws sun.security.pkcs11.wrapper.PKCS11Exception
writePublicData
in interface ISmartCard
aSessionID
- session handleaLabel
- label to be given to the dataaData
- data to be writtensun.security.pkcs11.wrapper.PKCS11Exception
public java.util.List<byte[]> readPrivateData(long aSessionID, java.lang.String aLabel) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
readPrivateData
in interface ISmartCard
aSessionID
- session handleaLabel
- label of the datasun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If no data in private area with the given label exists.public java.util.List<byte[]> readPublicData(long aSessionID, java.lang.String aLabel) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
readPublicData
in interface ISmartCard
aSessionID
- session handleaLabel
- label of the datasun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If no data with the given label in public area exists.public boolean isPublicKeyExist(long aSessionID, java.lang.String aLabel) throws sun.security.pkcs11.wrapper.PKCS11Exception
isPublicKeyExist
in interface ISmartCard
aSessionID
- session handleaLabel
- label of the public keysun.security.pkcs11.wrapper.PKCS11Exception
public boolean isPrivateKeyExist(long aSessionID, java.lang.String aLabel) throws sun.security.pkcs11.wrapper.PKCS11Exception
isPrivateKeyExist
in interface ISmartCard
aSessionID
- session handleaLabel
- label of the private keysun.security.pkcs11.wrapper.PKCS11Exception
public boolean isCertificateExist(long aSessionID, java.lang.String aLabel) throws sun.security.pkcs11.wrapper.PKCS11Exception
isCertificateExist
in interface ISmartCard
aSessionID
- session handleaLabel
- label of the certificatesun.security.pkcs11.wrapper.PKCS11Exception
public java.util.List<byte[]> readCertificate(long aSessionID, java.lang.String aLabel) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
readCertificate
in interface ISmartCard
aSessionID
- session handleaLabel
- certificate labelsun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If no certificate with given label is found.public byte[] readCertificate(long aSessionID, byte[] aCertSerialNo) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
readCertificate
in interface ISmartCard
aSessionID
- session handleaCertSerialNo
- certificate serial numbersun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If no certificate with the given serial number is found.public java.security.spec.KeySpec readPublicKeySpec(long aSessionID, java.lang.String aLabel) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
readPublicKeySpec
in interface ISmartCard
aSessionID
- session handleaLabel
- public key labelsun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If no public key with the given label is found.public java.security.spec.KeySpec readPublicKeySpec(long aSessionID, byte[] aCertSerialNo) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
readPublicKeySpec
in interface ISmartCard
aSessionID
- session handleaCertSerialNo
- certificate serial numbersun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public void updatePrivateData(long aSessionID, java.lang.String aLabel, byte[] aValue) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
updatePrivateData
in interface ISmartCard
aSessionID
- session handleaLabel
- label of data to be updatedaValue
- new value for datasun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If no data with given label in private area is found.public void updatePublicData(long aSessionID, java.lang.String aLabel, byte[] aValue) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
updatePublicData
in interface ISmartCard
aSessionID
- session handleaLabel
- label of data to be updatedaValue
- new value for datasun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If no data with given label is found.public void deletePrivateObject(long aSessionID, java.lang.String aLabel) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
deletePrivateObject
in interface ISmartCard
aSessionID
- session handleaLabel
- label of the object that will be deletedsun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If no object with given label in private area is found.public void deletePublicObject(long aSessionID, java.lang.String aLabel) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
deletePublicObject
in interface ISmartCard
aSessionID
- session handleaLabel
- label of the object that will be deletedsun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If no object with given label is found.public void deletePrivateData(long aSessionID, java.lang.String aLabel) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
deletePrivateData
in interface ISmartCard
aSessionID
- session handleaLabel
- label of the data that will be deletedsun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If no data with given label is found.public void deletePublicData(long aSessionID, java.lang.String aLabel) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
deletePublicData
in interface ISmartCard
aSessionID
- session handleaLabel
- label of the data that will be deletedsun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If no data with given label is found.public byte[] getRandomData(long aSessionID, int aDataLength) throws sun.security.pkcs11.wrapper.PKCS11Exception
getRandomData
in interface ISmartCard
aSessionID
- session handleaDataLength
- length of random data to be generatedsun.security.pkcs11.wrapper.PKCS11Exception
public byte[] getTokenSerialNo(long aSlotID) throws sun.security.pkcs11.wrapper.PKCS11Exception
getTokenSerialNo
in interface ISmartCard
aSlotID
- id of slot that token is presentsun.security.pkcs11.wrapper.PKCS11Exception
@Deprecated public byte[] signData(long aSessionID, java.lang.String aKeyLabel, byte[] aToBeSigned, long aMechanism) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
signData
in interface ISmartCard
aSessionID
- session handleaKeyLabel
- label of the private keyaToBeSigned
- Data to be signedaMechanism
- signature mechanism. Values can be obtained from PKCS11Constants with values starting CKM_sun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If no private key with given label is found.public byte[] signData(long aSessionID, java.lang.String aKeyLabel, byte[] aToBeSigned, sun.security.pkcs11.wrapper.CK_MECHANISM aMechanism) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
signData
in interface ISmartCard
aSessionID
- session handleaKeyLabel
- label of the private keyaToBeSigned
- Data to be signedaMechanism
- signature mechanism. Values can be obtained from PKCS11Constants with values starting CKM_sun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If no private key with given label is found.public byte[] signAndRecoverData(long aSessionID, java.lang.String aKeyLabel, byte[] aToBeSigned, sun.security.pkcs11.wrapper.CK_MECHANISM aMechanism) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
sun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public byte[] verifyAndRecoverData(long aSessionID, java.lang.String aKeyLabel, byte[] aSignedData, sun.security.pkcs11.wrapper.CK_MECHANISM aMechanism) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
sun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public void verifyData(long aSessionID, java.lang.String aKeyLabel, byte[] aData, byte[] aSignature, long aMechanism) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
verifyData
in interface ISmartCard
aSessionID
- session handleaKeyLabel
- label of the public keyaData
- Data that is signedaSignature
- SignatureaMechanism
- signature mechanism. Values can be obtained from PKCS11Constants with values starting CKM_sun.security.pkcs11.wrapper.PKCS11Exception
- If signature is invalid,PKCS11Exception with CKR_SIGNATURE_INVALID value is thrown. Other types of PKCS11Exception
can be thrown because of other reasons.SmartCardException
- If no public key with given label is found.public void verifyData(long aSessionID, java.lang.String aKeyLabel, byte[] aData, byte[] aSignature, sun.security.pkcs11.wrapper.CK_MECHANISM aMechanism) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
aSessionID
- session handleaKeyLabel
- label of the public keyaData
- Data that is signedaSignature
- SignatureaMechanism
- signature mechanism. Values can be obtained from PKCS11Constants with values starting CKM_sun.security.pkcs11.wrapper.PKCS11Exception
- If signature is invalid,PKCS11Exception with CKR_SIGNATURE_INVALID value is thrown. Other types of PKCS11Exception
can be thrown because of other reasons.SmartCardException
- If no public key with given label is found.public byte[] decodeSignatureIfItIsEC(long aSessionID, java.lang.String aKeyLabel, sun.security.pkcs11.wrapper.CK_MECHANISM mech, byte[] aSignature)
aSessionID
- aKeyLabel
- mech
- aSignature
- @Deprecated public byte[] encryptData(long aSessionID, java.lang.String aKeyLabel, byte[] aData, long aMechanism) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
encryptData
in interface ISmartCard
aSessionID
- session handleaKeyLabel
- label of the public keyaData
- data to be encryptedaMechanism
- encryption mechanism. Values can be obtained from PKCS11Constants with values starting CKM_sun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If no public key with given label is found.public byte[] encryptData(long aSessionID, java.lang.String aKeyLabel, byte[] aData, sun.security.pkcs11.wrapper.CK_MECHANISM aMechanism) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
encryptData
in interface ISmartCard
aSessionID
- session handleaKeyLabel
- label of the public keyaData
- data to be encryptedaMechanism
- encryption mechanism. Values can be obtained from PKCS11Constants with values starting CKM_sun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If no public key with given label is found.@Deprecated public byte[] decryptData(long aSessionID, java.lang.String aKeyLabel, byte[] aData, long aMechanism) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
decryptData
in interface ISmartCard
aSessionID
- session handleaKeyLabel
- label of the private keyaData
- encrypted dataaMechanism
- encryption mechanism. Values can be obtained from PKCS11Constants with values starting CKM_sun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If no private key with given label is found.public byte[] decryptData(long aSessionID, java.lang.String aKeyLabel, byte[] aData, sun.security.pkcs11.wrapper.CK_MECHANISM aMechanism) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
decryptData
in interface ISmartCard
aSessionID
- session handleaKeyLabel
- label of the private keyaData
- encrypted dataaMechanism
- encryption mechanism. Values can be obtained from PKCS11Constants with values starting CKM_sun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If no private key with given label is found.public void importCertificateAndKey(long aSessionID, java.lang.String aCertLabel, java.lang.String aKeyLabel, java.security.PrivateKey aPrivKey, java.security.cert.X509Certificate aCert) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException, java.io.IOException
importCertificateAndKey
in interface ISmartCard
aSessionID
- session handleaCertLabel
- label of certificateaKeyLabel
- label of keysaPrivKey
- private key.It must be java.security.interfaces.RSAPrivateCrtKey or java.security.interfaces.ECPrivateKey. Otherwise,
SmartCardException is thrown.aCert
- certificatesun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
java.io.IOException
@Deprecated public void importKeyPair(long aSessionID, java.lang.String aLabel, java.security.KeyPair aKeyPair, byte[] aSubject, boolean aIsSign, boolean aIsEncrypt) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException, java.io.IOException
importKeyPair
in interface ISmartCard
aSessionID
- session handle.aLabel
- Label of the keys.aKeyPair
- Key pair that will be imported.For now, RSA and ECDSA algorithms are supported.
For RSA, key types must be java.security.interfaces.RSAPublicKey and java.security.interfaces.RSAPrivateCrtKey;
for ECDSA key types must be java.security.interfaces.ECPublicKey and java.security.interfaces.ECPrivateKey.aSubject
- Value for CKA_SUBJECT field of private key. It may be null.aIsSign
- True if keys are for signature, false otherwise.aIsEncrypt
- True if keys are for encryption, false otherwise.sun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If given key types are not supported.java.io.IOException
public void changePassword(java.lang.String aOldPass, java.lang.String aNewPass, long aSessionID) throws sun.security.pkcs11.wrapper.PKCS11Exception
changePassword
in interface ISmartCard
aOldPass
- old pinaNewPass
- new pinaSessionID
- session handlesun.security.pkcs11.wrapper.PKCS11Exception
public void formatToken(java.lang.String aSOpin, java.lang.String aNewPIN, java.lang.String aLabel, int slotID) throws sun.security.pkcs11.wrapper.PKCS11Exception
formatToken
in interface ISmartCard
aSOpin
- SO's(Security Officer) pinaNewPIN
- User's new pinaLabel
- label to be given to the tokenslotID
- slot id that the token is presentsun.security.pkcs11.wrapper.PKCS11Exception
public void setSOPin(byte[] aSOPin, byte[] aNewSOPin, long aSessionHandle) throws sun.security.pkcs11.wrapper.PKCS11Exception
setSOPin
in interface ISmartCard
aSOPin
- SO's old pinaNewSOPin
- SO's new pinaSessionHandle
- session handlesun.security.pkcs11.wrapper.PKCS11Exception
public void changeUserPin(byte[] aSOPin, byte[] aUserPin, long aSessionHandle) throws sun.security.pkcs11.wrapper.PKCS11Exception
changeUserPin
in interface ISmartCard
aSOPin
- SO's pinaUserPin
- new pin for useraSessionHandle
- session handlesun.security.pkcs11.wrapper.PKCS11Exception
public boolean setContainer(byte[] aContainerLabel, long aSessionHandle)
setContainer
in interface ISmartCard
public boolean importCertificateAndKeyWithCSP(byte[] aAnahtarCifti, int aAnahtarLen, java.lang.String aScfname, java.lang.String aContextName, java.security.cert.X509Certificate aPbCertificate, int aSignOrEnc)
importCertificateAndKeyWithCSP
in interface ISmartCard
public boolean importCertificateAndKeyWithCSP(byte[] aAnahtarCifti, int aAnahtarLen, java.lang.String aScfname, java.lang.String aContextName, byte[] aPbCertificate, int aSignOrEnc)
importCertificateAndKeyWithCSP
in interface ISmartCard
public void createSecretKey(long aSessionID, SecretKey aKey) throws sun.security.pkcs11.wrapper.PKCS11Exception
createSecretKey
in interface ISmartCard
aSessionID
- session handleaKey
- Key type can be AESSecretKey,DES3SecretKey or HMACSecretKey.sun.security.pkcs11.wrapper.PKCS11Exception
public void importSecretKey(long aSessionID, SecretKey aKey) throws sun.security.pkcs11.wrapper.PKCS11Exception
importSecretKey
in interface ISmartCard
aSessionID
- session handleaKey
- Key type can be AESSecretKey,DES3SecretKey or HMACSecretKey.sun.security.pkcs11.wrapper.PKCS11Exception
public void importSecretKey(long aSessionID, SecretKeyTemplate aKeyTemplate) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
sun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
protected static CardType findCardType(java.lang.String aATRHex, Application aApp)
aATRHex
- ATR value as hexadecimalaApp
- public CardType getKartTipi()
getKartTipi
in interface ISmartCard
public long[] objeAra(long aSessionID, sun.security.pkcs11.wrapper.CK_ATTRIBUTE[] aTemplate) throws sun.security.pkcs11.wrapper.PKCS11Exception
objeAra
in interface ISmartCard
sun.security.pkcs11.wrapper.PKCS11Exception
public void getAttributeValue(long aSessionID, long aObjectID, sun.security.pkcs11.wrapper.CK_ATTRIBUTE[] aTemplate) throws sun.security.pkcs11.wrapper.PKCS11Exception
getAttributeValue
in interface ISmartCard
sun.security.pkcs11.wrapper.PKCS11Exception
public void changeLabel(long aSessionID, java.lang.String aOldLabel, java.lang.String aNewLabel) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
changeLabel
in interface ISmartCard
aSessionID
- aOldLabel
- Old labelaNewLabel
- New labelsun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
- If no object is found with the aOldLabel.public static void checkLicense()
public byte[] getModulusOfKey(long aSessionID, long aObjID) throws SmartCardException, sun.security.pkcs11.wrapper.PKCS11Exception
getModulusOfKey
in interface ISmartCard
SmartCardException
sun.security.pkcs11.wrapper.PKCS11Exception
public byte[] wrapKey(long sessionID, sun.security.pkcs11.wrapper.CK_MECHANISM mechanism, java.lang.String wrapperKeyLabel, java.lang.String labelOfKeyToWrap) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
wrapKey
in interface ISmartCard
sessionID
- session id (login requires)mechanism
- describe how to wrap key see CKM_RSA_PKCS, CKM_AES_CBC_PADwrapperKeyLabel
- wrapper key labellabelOfKeyToWrap
- key to wrapsun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public byte[] wrapKey(long sessionID, sun.security.pkcs11.wrapper.CK_MECHANISM mechanism, KeyTemplate wrapperKeyTemplate, KeyTemplate wrappingKeyTemplate) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
wrapKey
in interface ISmartCard
sessionID
- session id (login requires)mechanism
- describe how to wrap key see CKM_RSA_PKCS, CKM_AES_CBC_PADwrapperKeyTemplate
- wrapper keywrappingKeyTemplate
- key to wrapsun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public void unwrapKey(long sessionID, sun.security.pkcs11.wrapper.CK_MECHANISM mechanism, java.lang.String unwrapperKeyLabel, byte[] wrappedKey, KeyTemplate unwrappedKeyTemplate) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
unwrapKey
in interface ISmartCard
sessionID
- session id (login requires)mechanism
- describe how to unwrap key see CKM_RSA_PKCS, CKM_AES_CBC_PADunwrapperKeyLabel
- key to unwrap key into smartcard. unwrapping key must be in smartcard, and unwrap flag must be set.wrappedKey
- wrapped keyunwrappedKeyTemplate
- KeyTemplate to create new unwrapped key in smartcardsun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public void unwrapKey(long sessionID, sun.security.pkcs11.wrapper.CK_MECHANISM mechanism, KeyTemplate unwrapperKeyTemplate, byte[] wrappedKey, KeyTemplate unwrappedKeyTemplate) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
unwrapKey
in interface ISmartCard
sessionID
- session id (login requires)mechanism
- describe how to unwrap key see CKM_RSA_PKCS, CKM_AES_CBC_PADunwrapperKeyTemplate
- key to unwrap key into smartcard. unwrapping key must be in smartcard, and unwrap flag must be set.wrappedKey
- wrapped keyunwrappedKeyTemplate
- KeyTemplate to create new unwrapped key in smartcardsun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public void unwrapKey(long sessionID, sun.security.pkcs11.wrapper.CK_MECHANISM mechanism, byte[] certSerialNumber, byte[] wrappedKey, KeyTemplate unwrappedKeyTemplate) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
unwrapKey
in interface ISmartCard
sessionID
- session id (login requires)mechanism
- describe how to unwrap key see CKM_RSA_PKCS, CKM_AES_CBC_PADcertSerialNumber
- Certificate Serial Number of Private key to unwrap key into smartcard. unwrapping key must be in smartcard, and unwrap flag must be set.wrappedKey
- wrapped keyunwrappedKeyTemplate
- KeyTemplate to create new unwrapped key in smartcardsun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
public CardType getCardType()
getCardType
in interface ISmartCard
public void importKeyPair(long sessionID, KeyPairTemplate template) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
importKeyPair
in interface ISmartCard
sessionID
- session id login requirestemplate
- template to create KeyPairsun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
RSAKeyPairTemplate
,
ECKeyPairTemplate
public void createSecretKey(long sessionID, SecretKeyTemplate template) throws sun.security.pkcs11.wrapper.PKCS11Exception, SmartCardException
createSecretKey
in interface ISmartCard
sessionID
- session id login requirestemplate
- template to create SecretKeysun.security.pkcs11.wrapper.PKCS11Exception
SmartCardException
AESKeyTemplate
,
DES3KeyTemplate
,
HMACKeyTemplate
public int deleteCertificate(long aSessionID, java.lang.String aKeyLabel) throws sun.security.pkcs11.wrapper.PKCS11Exception
aSessionID
- session idaKeyLabel
- label of the certificate that will be deletedsun.security.pkcs11.wrapper.PKCS11Exception
public boolean isSupportsWrapUnwrap(long sessionId)
isSupportsWrapUnwrap
in interface ISmartCard
public sun.security.pkcs11.wrapper.PKCS11 getPKCS11()
Copyright © 2025. All rights reserved.