Re: [opensc-devel] OpenSC PKCS#11 and Session Objects
On Wed, 2010-11-10 at 13:03 -0600, Douglas E. Engert wrote: > > On 11/10/2010 11:37 AM, Andre Zepezauer wrote: > > Hello Douglas, > > > > you should check if NSS does support ECDSA. If it does, then it should > > verify the users certificate on its own. Calling a PKCS#11 provider for > > doing it, is some kind of abuse. (See quotation below) > > I agree, but that is not what I am seeing. > > > > > But if NSS tries to offload the verification to OpenSC, because it > > doesn't has support for ECDSA, then you are in trouble. > > Yes it has some support, as it knows how to list the algorithm and its > parameters, as well as tell PKCS#11 to create the public key passing it > the CKA_EC_POINT. > > > This is because > > the recipient of your signed e-mail also would need OpenSC for > > verification. Not practical I think. > > Well I hope to find out in the next few days is it will try and use > PKCS#11 for verification of signatures too, or find out of any of the > Microsoft products can handle the e-mail too. Some hints: http://stackoverflow.com/questions/2228860/encrypting-a-message-using-ecdsa-in-openssl http://mxr.mozilla.org/security/source/security/nss/lib/freebl/ec.c > I also need to look at the PKCS#11 session to see if OpenSC somehow > indicated to NSS that it could do verification. > > > > > PKCS#11 Section "6.2 Design goals": > > "Cryptoki was intended from the beginning to be an interface between > > applications and all kinds of portable cryptographic devices [...] It is > > not the goal of Cryptoki to be a generic interface to cryptographic > > operations or security services [...]" > > Interesting, as Solaris 10 passes all its crypto through "Solaris > Cryptographic > Framework" based on PKCS#11, so as to take advantage of any crypto hardware > if available. > > http://docs.sun.com/app/docs/doc/816-4557/scf-1?l=en&a=view > > > > > Regards > > Andre > > > > On Wed, 2010-11-10 at 10:56 -0600, Douglas E. Engert wrote: > >> Does OpenSC PKCS#11 support the creation of session objects? > >> Has anyone looked at doing this? > >> > >> I bring this up as I am testing EC mods to OpenSC using > >> Thunderbird to sign e-mail as a test. In my case, the user certificate > >> is using ECDSA with a named curve, and the test CA is also using > >> ECDSA to sign the user's certificate. > >> > >> Thunderbird 3.1.4 with NSS-3.12.x (x is at least 3) on Solaris 10 > >> tries to create a session public key, where the key is the public > >> key of the CA. I think NSS is going to use this public key to verify > >> the signature of the user's certificate asking the OpenSC PKCS#11 > >> ECDSA to do the verify. Depending on the card, this may have to be > >> done in software. > >> > >> See the attached edited PKCS11-SPY output, showing mechanisms, > >> open session, session info, and failed create object. Not shown > >> are pin/login, and retrieval of the user certificate. > >> > >> PKCS#11 2.20 says : Table 4 "R/O Public Session" > >> "The application has opened a read-only session. The application > >>has read-only access to public token objects and read/write access > >>to public session objects." > >> > >> I don't think NSS does this if the CA is using RSA to sign > >> the certificates, and I will try that next. (But eventually > >> some CA will start using ECDSA to sign certificates.) > >> > >> Even if the ECDSA verify was to be added to OpenSC PKCS11, > >> to be done in software, I would expect it might have to use > >> OpenSSL to do the verification. > >> > >> ___ > >> opensc-devel mailing list > >> opensc-devel@lists.opensc-project.org > >> http://www.opensc-project.org/mailman/listinfo/opensc-devel > > > > > ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel
Re: [opensc-devel] OpenSC PKCS#11 and Session Objects
On 11/10/2010 09:37 AM, Andre Zepezauer wrote: > Hello Douglas, > > you should check if NSS does support ECDSA. If it does, then it should > verify the users certificate on its own. Calling a PKCS#11 provider for > doing it, is some kind of abuse. (See quotation below) I varies with builds. Most Linux builds do not have internal support for ECDSA, though NSS itself recognizes it. If a PKCS #11 module that supports it is loaded, NSS will use that PKCS #11 module to do all the EC operations. I think that is what you are seeing. > But if NSS tries to offload the verification to OpenSC, because it > doesn't has support for ECDSA, then you are in trouble. This is because > the recipient of your signed e-mail also would need OpenSC for > verification. Not practical I think. I'm presuming if the recipient has an ECDSA certificate, then they can do ECC (either through some native implementation, or because it has ECC plugged in). > PKCS#11 Section "6.2 Design goals": > "Cryptoki was intended from the beginning to be an interface between > applications and all kinds of portable cryptographic devices [...] It is > not the goal of Cryptoki to be a generic interface to cryptographic > operations or security services [...]" While that is true, it has been functioning as a generic interface for over 15 years;). That being said, there is no requirement of OpenSC to function as a generic interface. If you need ECC with versions of NSS that does not supply it, there is nothing that says OpenSC must supply it, particularly if it's not in the OpenSC design point. If you need such a thing, providing your own software implementation of ECC is possible, and it's also possible to tell NSS to prefer using your software version rather over all others. bob > Regards > Andre > > On Wed, 2010-11-10 at 10:56 -0600, Douglas E. Engert wrote: >> Does OpenSC PKCS#11 support the creation of session objects? >> Has anyone looked at doing this? >> >> I bring this up as I am testing EC mods to OpenSC using >> Thunderbird to sign e-mail as a test. In my case, the user certificate >> is using ECDSA with a named curve, and the test CA is also using >> ECDSA to sign the user's certificate. >> >> Thunderbird 3.1.4 with NSS-3.12.x (x is at least 3) on Solaris 10 >> tries to create a session public key, where the key is the public >> key of the CA. I think NSS is going to use this public key to verify >> the signature of the user's certificate asking the OpenSC PKCS#11 >> ECDSA to do the verify. Depending on the card, this may have to be >> done in software. >> >> See the attached edited PKCS11-SPY output, showing mechanisms, >> open session, session info, and failed create object. Not shown >> are pin/login, and retrieval of the user certificate. >> >> PKCS#11 2.20 says : Table 4 "R/O Public Session" >> "The application has opened a read-only session. The application >> has read-only access to public token objects and read/write access >> to public session objects." >> >> I don't think NSS does this if the CA is using RSA to sign >> the certificates, and I will try that next. (But eventually >> some CA will start using ECDSA to sign certificates.) >> >> Even if the ECDSA verify was to be added to OpenSC PKCS11, >> to be done in software, I would expect it might have to use >> OpenSSL to do the verification. >> >> ___ >> opensc-devel mailing list >> opensc-devel@lists.opensc-project.org >> http://www.opensc-project.org/mailman/listinfo/opensc-devel > ___ > opensc-devel mailing list > opensc-devel@lists.opensc-project.org > http://www.opensc-project.org/mailman/listinfo/opensc-devel smime.p7s Description: S/MIME Cryptographic Signature ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel
Re: [opensc-devel] OpenSC PKCS#11 and Session Objects
On 11/10/2010 11:37 AM, Andre Zepezauer wrote: > Hello Douglas, > > you should check if NSS does support ECDSA. If it does, then it should > verify the users certificate on its own. Calling a PKCS#11 provider for > doing it, is some kind of abuse. (See quotation below) I agree, but that is not what I am seeing. > > But if NSS tries to offload the verification to OpenSC, because it > doesn't has support for ECDSA, then you are in trouble. Yes it has some support, as it knows how to list the algorithm and its parameters, as well as tell PKCS#11 to create the public key passing it the CKA_EC_POINT. > This is because > the recipient of your signed e-mail also would need OpenSC for > verification. Not practical I think. Well I hope to find out in the next few days is it will try and use PKCS#11 for verification of signatures too, or find out of any of the Microsoft products can handle the e-mail too. I also need to look at the PKCS#11 session to see if OpenSC somehow indicated to NSS that it could do verification. > > PKCS#11 Section "6.2 Design goals": > "Cryptoki was intended from the beginning to be an interface between > applications and all kinds of portable cryptographic devices [...] It is > not the goal of Cryptoki to be a generic interface to cryptographic > operations or security services [...]" Interesting, as Solaris 10 passes all its crypto through "Solaris Cryptographic Framework" based on PKCS#11, so as to take advantage of any crypto hardware if available. http://docs.sun.com/app/docs/doc/816-4557/scf-1?l=en&a=view > > Regards > Andre > > On Wed, 2010-11-10 at 10:56 -0600, Douglas E. Engert wrote: >> Does OpenSC PKCS#11 support the creation of session objects? >> Has anyone looked at doing this? >> >> I bring this up as I am testing EC mods to OpenSC using >> Thunderbird to sign e-mail as a test. In my case, the user certificate >> is using ECDSA with a named curve, and the test CA is also using >> ECDSA to sign the user's certificate. >> >> Thunderbird 3.1.4 with NSS-3.12.x (x is at least 3) on Solaris 10 >> tries to create a session public key, where the key is the public >> key of the CA. I think NSS is going to use this public key to verify >> the signature of the user's certificate asking the OpenSC PKCS#11 >> ECDSA to do the verify. Depending on the card, this may have to be >> done in software. >> >> See the attached edited PKCS11-SPY output, showing mechanisms, >> open session, session info, and failed create object. Not shown >> are pin/login, and retrieval of the user certificate. >> >> PKCS#11 2.20 says : Table 4 "R/O Public Session" >> "The application has opened a read-only session. The application >>has read-only access to public token objects and read/write access >>to public session objects." >> >> I don't think NSS does this if the CA is using RSA to sign >> the certificates, and I will try that next. (But eventually >> some CA will start using ECDSA to sign certificates.) >> >> Even if the ECDSA verify was to be added to OpenSC PKCS11, >> to be done in software, I would expect it might have to use >> OpenSSL to do the verification. >> >> ___ >> opensc-devel mailing list >> opensc-devel@lists.opensc-project.org >> http://www.opensc-project.org/mailman/listinfo/opensc-devel > > -- Douglas E. Engert Argonne National Laboratory 9700 South Cass Avenue Argonne, Illinois 60439 (630) 252-5444 ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel
Re: [opensc-devel] OpenSC PKCS#11 and Session Objects
Hello Douglas, you should check if NSS does support ECDSA. If it does, then it should verify the users certificate on its own. Calling a PKCS#11 provider for doing it, is some kind of abuse. (See quotation below) But if NSS tries to offload the verification to OpenSC, because it doesn't has support for ECDSA, then you are in trouble. This is because the recipient of your signed e-mail also would need OpenSC for verification. Not practical I think. PKCS#11 Section "6.2 Design goals": "Cryptoki was intended from the beginning to be an interface between applications and all kinds of portable cryptographic devices [...] It is not the goal of Cryptoki to be a generic interface to cryptographic operations or security services [...]" Regards Andre On Wed, 2010-11-10 at 10:56 -0600, Douglas E. Engert wrote: > Does OpenSC PKCS#11 support the creation of session objects? > Has anyone looked at doing this? > > I bring this up as I am testing EC mods to OpenSC using > Thunderbird to sign e-mail as a test. In my case, the user certificate > is using ECDSA with a named curve, and the test CA is also using > ECDSA to sign the user's certificate. > > Thunderbird 3.1.4 with NSS-3.12.x (x is at least 3) on Solaris 10 > tries to create a session public key, where the key is the public > key of the CA. I think NSS is going to use this public key to verify > the signature of the user's certificate asking the OpenSC PKCS#11 > ECDSA to do the verify. Depending on the card, this may have to be > done in software. > > See the attached edited PKCS11-SPY output, showing mechanisms, > open session, session info, and failed create object. Not shown > are pin/login, and retrieval of the user certificate. > > PKCS#11 2.20 says : Table 4 "R/O Public Session" > "The application has opened a read-only session. The application > has read-only access to public token objects and read/write access > to public session objects." > > I don't think NSS does this if the CA is using RSA to sign > the certificates, and I will try that next. (But eventually > some CA will start using ECDSA to sign certificates.) > > Even if the ECDSA verify was to be added to OpenSC PKCS11, > to be done in software, I would expect it might have to use > OpenSSL to do the verification. > > ___ > opensc-devel mailing list > opensc-devel@lists.opensc-project.org > http://www.opensc-project.org/mailman/listinfo/opensc-devel ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel
[opensc-devel] OpenSC PKCS#11 and Session Objects
Does OpenSC PKCS#11 support the creation of session objects? Has anyone looked at doing this? I bring this up as I am testing EC mods to OpenSC using Thunderbird to sign e-mail as a test. In my case, the user certificate is using ECDSA with a named curve, and the test CA is also using ECDSA to sign the user's certificate. Thunderbird 3.1.4 with NSS-3.12.x (x is at least 3) on Solaris 10 tries to create a session public key, where the key is the public key of the CA. I think NSS is going to use this public key to verify the signature of the user's certificate asking the OpenSC PKCS#11 ECDSA to do the verify. Depending on the card, this may have to be done in software. See the attached edited PKCS11-SPY output, showing mechanisms, open session, session info, and failed create object. Not shown are pin/login, and retrieval of the user certificate. PKCS#11 2.20 says : Table 4 "R/O Public Session" "The application has opened a read-only session. The application has read-only access to public token objects and read/write access to public session objects." I don't think NSS does this if the CA is using RSA to sign the certificates, and I will try that next. (But eventually some CA will start using ECDSA to sign certificates.) Even if the ECDSA verify was to be added to OpenSC PKCS11, to be done in software, I would expect it might have to use OpenSSL to do the verification. -- Douglas E. Engert Argonne National Laboratory 9700 South Cass Avenue Argonne, Illinois 60439 (630) 252-5444 9: C_GetMechanismList [in] slotID = 0x1 [out] pMechanismList[14]: CKM_SHA_1 CKM_SHA256 CKM_SHA384 CKM_SHA512 CKM_MD5 CKM_RIPEMD160 Unknown Mechanism (1210) CKM_ECDSA CKM_RSA_X_509 CKM_RSA_PKCS CKM_SHA1_RSA_PKCS CKM_MD5_RSA_PKCS CKM_RIPEMD160_RSA_PKCS CKM_RSA_PKCS_KEY_PAIR_GEN Returned: 0 CKR_OK 10: C_OpenSession [in] slotID = 0x1 [in] flags = 0x4 pApplication=f61afc00 Notify=fe0dbb30 [out] *phSession = 0xf6175700 Returned: 0 CKR_OK 242: C_GetSessionInfo [in] hSession = 0xf6175700 [out] pInfo: slotID: 1 state: ' CKS_RO_USER_FUNCTIONS' flags: 4 CKF_SERIAL_SESSION ulDeviceError: 0 Returned: 0 CKR_OK 260: C_CreateObject [in] hSession = 0xf6175700 [in] pTemplate[7]: CKA_CLASS CKO_PUBLIC_KEY CKA_KEY_TYPE CKK_EC CKA_TOKEN False CKA_VERIFYTrue CKA_DERIVETrue CKA_ECDSA_PARAMS [size : 0xA (10)] 06082A86 48CE3D03 0107 CKA_EC_POINT [size : 0x43 (67)] 04410431 88665C1D CD6565F1 1B9C300E 7731B630 177FD19D 53E33F33 A20C1798 B82BA3CA 251EBD29 5F28AB22 F7794FBF 3CB32A41 BF22FD7B 8E47233F 40ECE85C 10FC2B Returned: 181 CKR_SESSION_READ_ONLY ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel