Decryption and signature creation operations require login to smartcard. The methods decryptDataWithCertSerialNo(…)
, decryptData(…)
, signDataWithCertSerialNo(…)
, and signData(…)
are used to perform cryptogrtaphic operations. Only decryption and signature creation, which need private key access, should be performed in smartcard. Other operations can be performed outside which is much more efficient.
The modules using signature creation and decryption operations take objects of BaseSigner
and BaseCipher
interfaces. Thus the classes SCSignerWithCertSerialNo
, SCSignerWithKeyLabel
, SCCipherWithCertSerialNo
and SCCipherWithKeyLabel
are used.
In the sample code below, there are classes performing their operations by using certificate serial number.
SCSignerWithCertSerialNo signer = new SCSignerWithCertSerialNo(sc, session, slot,signatureCert.getSerialNumber().toByteArray(), Algorithms.SIGNATURE_RSA_SHA1);
BaseSigner signer = new SCSignerWithCertSerialNo(sc, session, slots[0], cert.getSerialNumber().GetData(),SignatureAlg.RSA_SHA1.getName());
In the sample code below, there are classes performing their operations by using key label.
SCSignerWithKeyLabel signer = new SCSignerWithKeyLabel(sc, session, slot, "yasemin.akturk#SIGN0",Algorithms.SIGNATURE_RSA_SHA1);
BaseSigner signer = new SCSignerWithKeyLabel(sc, session, slot, "yasemin.akturk#ug.netSIGN0",SignatureAlg.RSA_SHA1.getName());