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

Unified Diff: content/renderer/webcrypto/webcrypto_util.h

Issue 184043021: [webcrypto] JWK: Updated import(ext, key_ops) and added export of symmetric keys (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wcAesKw_nss1
Patch Set: fixes for eroman Created 6 years, 10 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
Index: content/renderer/webcrypto/webcrypto_util.h
diff --git a/content/renderer/webcrypto/webcrypto_util.h b/content/renderer/webcrypto/webcrypto_util.h
index 28eb8e0f64e9bcdedb8c54e81b4499f003cb25f3..92274c68dadacbc5b5ee098f7242cf8585751670 100644
--- a/content/renderer/webcrypto/webcrypto_util.h
+++ b/content/renderer/webcrypto/webcrypto_util.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
#include "base/basictypes.h"
+#include "base/strings/string_piece.h"
+#include "base/values.h"
#include "content/common/content_export.h"
#include "third_party/WebKit/public/platform/WebArrayBuffer.h"
#include "third_party/WebKit/public/platform/WebCrypto.h" // TODO(eroman): delete
@@ -73,9 +75,9 @@ class CONTENT_EXPORT Status {
// base64 decoded.
static Status ErrorJwkBase64Decode(const std::string& property);
- // The "extractable" parameter was specified but was
+ // The "ext" parameter was specified but was
// incompatible with the value requested by the Web Crypto call.
- static Status ErrorJwkExtractableInconsistent();
+ static Status ErrorJwkExtInconsistent();
// The "alg" parameter could not be converted to an equivalent
// WebCryptoAlgorithm. Either it was malformed or unrecognized.
@@ -91,11 +93,23 @@ class CONTENT_EXPORT Status {
// The "use" parameter was specified, however it couldn't be converted to an
// equivalent Web Crypto usage.
- static Status ErrorJwkUnrecognizedUsage();
+ static Status ErrorJwkUnrecognizedUse();
+
+ // The "key_ops" parameter was specified, however one of the values in the
+ // array couldn't be converted to an equivalent Web Crypto usage.
+ static Status ErrorJwkUnrecognizedKeyop();
// The "use" parameter was specified, however it is incompatible with that
// specified by the Web Crypto import operation.
- static Status ErrorJwkUsageInconsistent();
+ static Status ErrorJwkUseInconsistent();
+
+ // The "key_ops" parameter was specified, however it is incompatible with that
+ // specified by the Web Crypto import operation.
+ static Status ErrorJwkKeyopsInconsistent();
+
+ // Both the "key_ops" and the "use" parameters were specified, however they
+ // are incompatible with each other.
+ static Status ErrorJwkUseAndKeyopsInconsistent();
// TODO(eroman): Private key import through JWK is not yet supported.
static Status ErrorJwkRsaPrivateKeyUnsupported();
@@ -218,7 +232,21 @@ blink::WebArrayBuffer CreateArrayBuffer(const uint8* data,
// This function decodes unpadded 'base64url' encoded data, as described in
// RFC4648 (http://www.ietf.org/rfc/rfc4648.txt) Section 5.
// In Web Crypto, this type of encoding is only used inside JWK.
-bool Base64DecodeUrlSafe(const std::string& input, std::string* output);
+CONTENT_EXPORT bool Base64DecodeUrlSafe(const std::string& input,
+ std::string* output);
+
+// Produces an unpadded 'base64url' encoding of the input data, the opposite of
+// Base64DecodeUrlSafe() above.
+void Base64EncodeUrlSafe(const base::StringPiece& input, std::string* output);
+
+// Composes a Web Crypto usage mask from an array of JWK key_ops values.
+CONTENT_EXPORT Status GetWebCryptoUsagesFromJwkKeyOps(
eroman 2014/03/07 19:33:06 We should introduce a jwk.h header and move these
padolph 2014/03/09 22:06:36 Acknowledged.
+ base::ListValue* jwk_key_ops_value,
+ blink::WebCryptoKeyUsageMask* jwk_key_ops_mask);
+
+// Composes a JWK key_ops array from a Web Crypto usage mask.
+void GetJwkKeyOpsFromWebCryptoUsages(blink::WebCryptoKeyUsageMask usage_mask,
+ base::ListValue* jwk_key_ops);
CONTENT_EXPORT bool IsHashAlgorithm(blink::WebCryptoAlgorithmId alg_id);

Powered by Google App Engine
This is Rietveld 408576698