NB! This project is outdated and unmaintained, please refer to the OpenSC MacInstaller instead!
| r82 | r121 | |
|---|---|---|
| 58 | 58 | uint32 inputSize, bool encrypting) |
| 59 | 59 | { |
| 60 | otdLog("In OpenSCKeyHandle::ge |
|
| 60 | otdLog("In OpenSCKeyHandle::geOutputSize()\n"); | |
| 61 | 61 | secdebug("crypto", "getOutputSize"); |
| 62 | 62 | CssmError::throwMe(CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED); |
| … | … | |
| 130 | 130 | if (outputData == NULL) |
| 131 | 131 | CssmError::throwMe(CSSMERR_CSP_MEMORY_ERROR); |
| 132 | ||
| 133 | otdLog(" Signing buffers: inlen=%d, outlen=%d\n",input.Length, keyLength); | |
| 132 | 134 | |
| 133 | 135 | // Call OpenSC to do the actual signing |
| r44 | r121 | |
|---|---|---|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | size_t OpenSCKeyRecord::sizeInBits() const | |
| 99 | { | |
| 100 | sc_pkcs15_prkey_info *prkey = (sc_pkcs15_prkey_info *)mPrKeyObj->data; | |
| 101 | return prkey->modulus_length; | |
| 102 | } | |
| 98 | 103 | |
| 99 | 104 | /************************** OpenSCKeyRecord *****************************/ |
| r44 | r121 | |
|---|---|---|
| 68 | 68 | ~OpenSCKeyRecord() {} |
| 69 | 69 | |
| 70 | size_t sizeInBits() const |
|
| 70 | size_t sizeInBits() const; | |
| 71 | 71 | |
| 72 | 72 | virtual void getOwner(AclOwnerPrototype &owner); |
| r44 | r121 | |
|---|---|---|
| 46 | 46 | OpenSCSchema::OpenSCSchema() : |
| 47 | 47 | mKeyAlgorithmCoder(uint32(CSSM_ALGID_RSA)), |
| 48 | mKey |
|
| 48 | mKeyAttributeCoder() | |
| 49 | 49 | { |
| 50 | 50 | } |
| … | … | |
| 67 | 67 | // Other key valuess |
| 68 | 68 | mr.attributeCoder(kSecKeyKeyType, &mKeyAlgorithmCoder); |
| 69 | mr.attributeCoder(kSecKeyKeySizeInBits, &mKey |
|
| 70 | mr.attributeCoder(kSecKeyEffectiveKeySize, &mKey |
|
| 69 | mr.attributeCoder(kSecKeyKeySizeInBits, &mKeyAttributeCoder); | |
| 70 | mr.attributeCoder(kSecKeyEffectiveKeySize, &mKeyAttributeCoder); | |
| 71 | 71 | |
| 72 | 72 | // Key attributes |
| r44 | r121 | |
|---|---|---|
| 41 | 41 | #include "Schema.h" |
| 42 | 42 | #include "OpenSCKeyHandle.h" |
| 43 | #include "OpenSCAttributeCoder.h" | |
| 43 | 44 | |
| 44 | 45 | namespace Tokend |
| … | … | |
| 63 | 64 | private: |
| 64 | 65 | Tokend::ConstAttributeCoder mKeyAlgorithmCoder; |
| 65 | |
|
| 66 | OpenSCKeyAttributeCoder mKeyAttributeCoder; | |
| 66 | 67 | |
| 67 | 68 | OpenSCKeyHandleFactory mOpenSCKeyHandleFactory; |
| r92 | r121 | |
|---|---|---|
| 297 | 297 | TOKEND_MAX_UID - strlen(tokenUid)); |
| 298 | 298 | |
| 299 | { | |
| 300 | /* replace non ASCII chars by '?' */ | |
| 301 | int i; | |
| 302 | unsigned char *c = (unsigned char *)tokenUid; | |
| 303 | ||
| 304 | for (i=0; tokenUid[i]; i++) | |
| 305 | if (c[i] > 127) | |
| 306 | tokenUid[i] = '?'; | |
| 307 | } | |
| 308 | ||
| 299 | 309 | otdLog(" score = %d, tokenUid = \"%s\"\n", score, tokenUid); |
| 300 | 310 | } |