Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Unified Diff: content/child/webcrypto/webcrypto_impl.cc

Issue 206833003: [webcrypto] Add wrap/unwrap forwarding methods to WebCryptoImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/webcrypto/webcrypto_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/webcrypto_impl.cc
diff --git a/content/child/webcrypto/webcrypto_impl.cc b/content/child/webcrypto/webcrypto_impl.cc
index 927c36f9b009d725d0704de1e153ca95d886016e..f3168354a23907ea5d595b863d2d6bcbbda2b6ab 100644
--- a/content/child/webcrypto/webcrypto_impl.cc
+++ b/content/child/webcrypto/webcrypto_impl.cc
@@ -196,6 +196,47 @@ void WebCryptoImpl::verifySignature(const blink::WebCryptoAlgorithm& algorithm,
result.completeWithBoolean(signature_match);
}
+void WebCryptoImpl::wrapKey(blink::WebCryptoKeyFormat format,
+ const blink::WebCryptoKey& key,
+ const blink::WebCryptoKey& wrapping_key,
+ const blink::WebCryptoAlgorithm& wrap_algorithm,
+ blink::WebCryptoResult result) {
+ blink::WebArrayBuffer buffer;
+ // TODO(eroman): Use the same parameter ordering.
+ Status status = webcrypto::WrapKey(
+ format, wrapping_key, key, wrap_algorithm, &buffer);
+ if (status.IsError())
+ CompleteWithError(status, &result);
+ else
+ result.completeWithBuffer(buffer);
+}
+
+void WebCryptoImpl::unwrapKey(
+ blink::WebCryptoKeyFormat format,
+ const unsigned char* wrapped_key,
+ unsigned wrapped_key_size,
+ const blink::WebCryptoKey& wrapping_key,
+ const blink::WebCryptoAlgorithm& unwrap_algorithm,
+ const blink::WebCryptoAlgorithm& unwrapped_key_algorithm,
+ bool extractable,
+ blink::WebCryptoKeyUsageMask usages,
+ blink::WebCryptoResult result) {
+ blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ Status status =
+ webcrypto::UnwrapKey(format,
+ webcrypto::CryptoData(wrapped_key, wrapped_key_size),
+ wrapping_key,
+ unwrap_algorithm,
+ unwrapped_key_algorithm,
+ extractable,
+ usages,
+ &key);
+ if (status.IsError())
+ CompleteWithError(status, &result);
+ else
+ result.completeWithKey(key);
+}
+
bool WebCryptoImpl::digestSynchronous(
const blink::WebCryptoAlgorithmId algorithm_id,
const unsigned char* data,
« no previous file with comments | « content/child/webcrypto/webcrypto_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698