Index: content/renderer/webcrypto/webcrypto_impl_nss.cc |
diff --git a/content/renderer/webcrypto/webcrypto_impl_nss.cc b/content/renderer/webcrypto/webcrypto_impl_nss.cc |
index a20f72fb6bfd1bfe4336cb9a60deb8f15e3bd3f0..452d2a7c91dd34a52df66934b85ed8cd4e179627 100644 |
--- a/content/renderer/webcrypto/webcrypto_impl_nss.cc |
+++ b/content/renderer/webcrypto/webcrypto_impl_nss.cc |
@@ -263,8 +263,9 @@ bool WebCryptoImpl::DigestInternal( |
bool WebCryptoImpl::GenerateKeyInternal( |
const WebKit::WebCryptoAlgorithm& algorithm, |
- scoped_ptr<WebKit::WebCryptoKeyHandle>* key, |
- WebKit::WebCryptoKeyType* type) { |
+ bool extractable, |
+ WebKit::WebCryptoKeyUsageMask usage_mask, |
+ WebKit::WebCryptoKey* key) { |
CK_MECHANISM_TYPE mech = WebCryptoAlgorithmToGenMechanism(algorithm); |
unsigned int keylen_bytes = 0; |
@@ -317,9 +318,9 @@ bool WebCryptoImpl::GenerateKeyInternal( |
return false; |
} |
- key->reset(new SymKeyHandle(pk11_key.Pass())); |
- *type = key_type; |
- |
+ *key = WebKit::WebCryptoKey::create( |
+ new SymKeyHandle(pk11_key.Pass()), |
+ key_type, extractable, algorithm, usage_mask); |
return true; |
} |
@@ -328,14 +329,21 @@ bool WebCryptoImpl::ImportKeyInternal( |
WebKit::WebCryptoKeyFormat format, |
const unsigned char* key_data, |
unsigned key_data_size, |
- const WebKit::WebCryptoAlgorithm& algorithm, |
+ const WebKit::WebCryptoAlgorithm& algorithm_or_null, |
+ bool extractable, |
WebKit::WebCryptoKeyUsageMask usage_mask, |
- scoped_ptr<WebKit::WebCryptoKeyHandle>* handle, |
- WebKit::WebCryptoKeyType* type) { |
+ WebKit::WebCryptoKey* key) { |
+ // TODO(eroman): Currently expects algorithm to always be specified, as it is |
+ // required for raw format. |
+ if (algorithm_or_null.isNull()) |
+ return false; |
+ const WebKit::WebCryptoAlgorithm& algorithm = algorithm_or_null; |
+ |
+ WebKit::WebCryptoKeyType type; |
switch (algorithm.id()) { |
case WebKit::WebCryptoAlgorithmIdHmac: |
case WebKit::WebCryptoAlgorithmIdAesCbc: |
- *type = WebKit::WebCryptoKeyTypeSecret; |
+ type = WebKit::WebCryptoKeyTypeSecret; |
break; |
// TODO(bryaneyler): Support more key types. |
default: |
@@ -402,9 +410,8 @@ bool WebCryptoImpl::ImportKeyInternal( |
return false; |
} |
- scoped_ptr<SymKeyHandle> sym_key(new SymKeyHandle(pk11_sym_key.Pass())); |
- *handle = sym_key.Pass(); |
- |
+ *key = WebKit::WebCryptoKey::create(new SymKeyHandle(pk11_sym_key.Pass()), |
+ type, extractable, algorithm, usage_mask); |
return true; |
} |