void GenerateKey::operator () (Key &publicKey, const KeySpec &pubSpec, Key &privateKey, const KeySpec &privSpec) { check(CSSM_GenerateKeyPair(handle(), pubSpec.usage, pubSpec.attributes, pubSpec.label, publicKey.makeNewKey(attachment()), privSpec.usage, privSpec.attributes, privSpec.label, &compositeRcc(), privateKey.makeNewKey(attachment()))); publicKey->activate(); privateKey->activate(); }
Key GenerateKey::operator () (const KeySpec &spec) { Key key; check(CSSM_GenerateKey(handle(), spec.usage, spec.attributes, spec.label, &compositeRcc(), key.makeNewKey(attachment()))); key->activate(); return key; }
Key WrapKey::operator () (Key &keyToBeWrapped, const CssmData *descriptiveData) { Key wrappedKey; check(CSSM_WrapKey(handle(), neededCred(), keyToBeWrapped, descriptiveData, wrappedKey.makeNewKey(attachment()))); wrappedKey->activate(); return wrappedKey; }
Key DeriveKey::operator () (CssmData *param, const KeySpec &spec) { Key derivedKey; check(CSSM_DeriveKey(handle(), param, spec.usage, spec.attributes, spec.label, &compositeRcc(), derivedKey.makeNewKey(attachment()))); derivedKey->activate(); return derivedKey; }
Key UnwrapKey::operator () (const CssmKey &keyToBeUnwrapped, const KeySpec &spec) { CssmData data(reinterpret_cast<uint8 *>(1), 0); Key unwrappedKey; check(CSSM_UnwrapKey(handle(), NULL, &keyToBeUnwrapped, spec.usage, spec.attributes, spec.label, &compositeRcc(), unwrappedKey.makeNewKey(attachment()), &data)); unwrappedKey->activate(); return unwrappedKey; }
Key UnwrapKey::operator () (const CssmKey &keyToBeUnwrapped, const KeySpec &spec, CssmData *descriptiveData) { Key unwrappedKey; check(CSSM_UnwrapKey(handle(), NULL, &keyToBeUnwrapped, spec.usage, spec.attributes, spec.label, &compositeRcc(), unwrappedKey.makeNewKey(attachment()), descriptiveData)); unwrappedKey->activate(); return unwrappedKey; }