// FIXME: At the time of writing this is not a part of the spec. It is based an // an unpublished editor's draft for: // https://www.w3.org/Bugs/Public/show_bug.cgi?id=24963 // See http://crbug.com/373917. static bool copyJwkDictionaryToJson(const Dictionary& dict, CString& jsonUtf8, CryptoResult* result) { RefPtr<JSONObject> jsonObject = JSONObject::create(); if (!copyStringProperty("kty", dict, jsonObject.get())) { result->completeWithError(blink::WebCryptoErrorTypeData, "The required JWK property \"kty\" was missing"); return false; } copyStringProperty("use", dict, jsonObject.get()); copySequenceOfStringProperty("key_ops", dict, jsonObject.get()); copyStringProperty("alg", dict, jsonObject.get()); bool ext; if (dict.get("ext", ext)) jsonObject->setBoolean("ext", ext); const char* const propertyNames[] = { "d", "n", "e", "p", "q", "dp", "dq", "qi", "k" }; for (unsigned i = 0; i < WTF_ARRAY_LENGTH(propertyNames); ++i) copyStringProperty(propertyNames[i], dict, jsonObject.get()); String json = jsonObject->toJSONString(); jsonUtf8 = json.utf8(); return true; }
Boolean CGDefaultsCopyString(const char* cStr, CFStringRef* strDst) { return copyStringProperty(cStr, copyDefaultValue, strDst); }