summaryrefslogtreecommitdiffstats
path: root/content/child/webcrypto/webcrypto_impl.cc
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-18 20:27:08 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-18 20:27:08 +0000
commit5daca04707be94c5b2991ae5e7f7ebd1c76352bc (patch)
tree79320ef3123d0bb8185a182724d7d704af723032 /content/child/webcrypto/webcrypto_impl.cc
parentb7e61c2219059a2b2bda9eb76fabbbba2c121e8c (diff)
downloadchromium_src-5daca04707be94c5b2991ae5e7f7ebd1c76352bc.zip
chromium_src-5daca04707be94c5b2991ae5e7f7ebd1c76352bc.tar.gz
chromium_src-5daca04707be94c5b2991ae5e7f7ebd1c76352bc.tar.bz2
[webcrypto] Implement structured clone of keys (chromium-side).
The serialized format saves keys as: * spki for public RSA keys * pkcs8 for private RSA keys * raw for AES and HMAC keys The testing for this is done on the blink side by (see https://codereview.chromium.org/195543002/) [2] PKCS8 import/export is not yet implemented. I will re-visit the serialization of private keys in a follow-up change. BUG=245025 Review URL: https://codereview.chromium.org/196513002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257723 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/child/webcrypto/webcrypto_impl.cc')
-rw-r--r--content/child/webcrypto/webcrypto_impl.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/content/child/webcrypto/webcrypto_impl.cc b/content/child/webcrypto/webcrypto_impl.cc
index 1af726d..97d1372 100644
--- a/content/child/webcrypto/webcrypto_impl.cc
+++ b/content/child/webcrypto/webcrypto_impl.cc
@@ -207,4 +207,29 @@ bool WebCryptoImpl::digestSynchronous(
.IsSuccess();
}
+bool WebCryptoImpl::deserializeKeyForClone(
+ const blink::WebCryptoKeyAlgorithm& algorithm,
+ blink::WebCryptoKeyType type,
+ bool extractable,
+ blink::WebCryptoKeyUsageMask usages,
+ const unsigned char* key_data,
+ unsigned key_data_size,
+ blink::WebCryptoKey& key) {
+ Status status = webcrypto::DeserializeKeyForClone(
+ algorithm,
+ type,
+ extractable,
+ usages,
+ webcrypto::CryptoData(key_data, key_data_size),
+ &key);
+ return status.IsSuccess();
+}
+
+bool WebCryptoImpl::serializeKeyForClone(
+ const blink::WebCryptoKey& key,
+ blink::WebVector<unsigned char>& key_data) {
+ Status status = webcrypto::SerializeKeyForClone(key, &key_data);
+ return status.IsSuccess();
+}
+
} // namespace content