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

Side by Side Diff: content/child/webcrypto/jwk.cc

Issue 267323009: [webcrypto] Add deriveBits key_op to JWK import/export. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/child/webcrypto/webcrypto_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "jwk.h" 5 #include "jwk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <map> 9 #include <map>
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // the table below, and describes the operations for which this key may be 62 // the table below, and describes the operations for which this key may be
63 // used. 63 // used.
64 // +-------+--------------------------------------------------------------+ 64 // +-------+--------------------------------------------------------------+
65 // | "encrypt" | encrypt operations | 65 // | "encrypt" | encrypt operations |
66 // | "decrypt" | decrypt operations | 66 // | "decrypt" | decrypt operations |
67 // | "sign" | sign (MAC) operations | 67 // | "sign" | sign (MAC) operations |
68 // | "verify" | verify (MAC) operations | 68 // | "verify" | verify (MAC) operations |
69 // | "wrapKey" | key wrap | 69 // | "wrapKey" | key wrap |
70 // | "unwrapKey" | key unwrap | 70 // | "unwrapKey" | key unwrap |
71 // | "deriveKey" | key derivation | 71 // | "deriveKey" | key derivation |
72 // | "deriveBits" | key derivation TODO(padolph): not currently supported | 72 // | "deriveBits" | key derivation |
73 // +-------+--------------------------------------------------------------+ 73 // +-------+--------------------------------------------------------------+
74 // 74 //
75 // - use (Key Use) 75 // - use (Key Use)
76 // The use field contains a single entry from the table below. 76 // The use field contains a single entry from the table below.
77 // +-------+--------------------------------------------------------------+ 77 // +-------+--------------------------------------------------------------+
78 // | "sig" | equivalent to key_ops of [sign, verify] | 78 // | "sig" | equivalent to key_ops of [sign, verify] |
79 // | "enc" | equivalent to key_ops of [encrypt, decrypt, wrapKey, | 79 // | "enc" | equivalent to key_ops of [encrypt, decrypt, wrapKey, |
80 // | | unwrapKey, deriveKey, deriveBits] | 80 // | | unwrapKey, deriveKey, deriveBits] |
81 // +-------+--------------------------------------------------------------+ 81 // +-------+--------------------------------------------------------------+
82 // 82 //
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 // Creates an RSA-OAEP algorithm. It is an error to call this with a hash_id 221 // Creates an RSA-OAEP algorithm. It is an error to call this with a hash_id
222 // that is not a SHA*. 222 // that is not a SHA*.
223 blink::WebCryptoAlgorithm CreateRsaOaepImportAlgorithm( 223 blink::WebCryptoAlgorithm CreateRsaOaepImportAlgorithm(
224 blink::WebCryptoAlgorithmId hash_id) { 224 blink::WebCryptoAlgorithmId hash_id) {
225 return CreateRsaHashedImportAlgorithm(blink::WebCryptoAlgorithmIdRsaOaep, 225 return CreateRsaHashedImportAlgorithm(blink::WebCryptoAlgorithmIdRsaOaep,
226 hash_id); 226 hash_id);
227 } 227 }
228 228
229 // Web Crypto equivalent usage mask for JWK 'use' = 'enc'. 229 // Web Crypto equivalent usage mask for JWK 'use' = 'enc'.
230 // TODO(padolph): Add 'deriveBits' once supported by Blink.
231 const blink::WebCryptoKeyUsageMask kJwkEncUsage = 230 const blink::WebCryptoKeyUsageMask kJwkEncUsage =
232 blink::WebCryptoKeyUsageEncrypt | blink::WebCryptoKeyUsageDecrypt | 231 blink::WebCryptoKeyUsageEncrypt | blink::WebCryptoKeyUsageDecrypt |
233 blink::WebCryptoKeyUsageWrapKey | blink::WebCryptoKeyUsageUnwrapKey | 232 blink::WebCryptoKeyUsageWrapKey | blink::WebCryptoKeyUsageUnwrapKey |
234 blink::WebCryptoKeyUsageDeriveKey; 233 blink::WebCryptoKeyUsageDeriveKey | blink::WebCryptoKeyUsageDeriveBits;
235 // Web Crypto equivalent usage mask for JWK 'use' = 'sig'. 234 // Web Crypto equivalent usage mask for JWK 'use' = 'sig'.
236 const blink::WebCryptoKeyUsageMask kJwkSigUsage = 235 const blink::WebCryptoKeyUsageMask kJwkSigUsage =
237 blink::WebCryptoKeyUsageSign | blink::WebCryptoKeyUsageVerify; 236 blink::WebCryptoKeyUsageSign | blink::WebCryptoKeyUsageVerify;
238 237
239 typedef blink::WebCryptoAlgorithm (*AlgorithmCreationFunc)(); 238 typedef blink::WebCryptoAlgorithm (*AlgorithmCreationFunc)();
240 239
241 class JwkAlgorithmInfo { 240 class JwkAlgorithmInfo {
242 public: 241 public:
243 JwkAlgorithmInfo() 242 JwkAlgorithmInfo()
244 : creation_func_(NULL), 243 : creation_func_(NULL),
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 986
988 std::string json; 987 std::string json;
989 base::JSONWriter::Write(&jwk_dict, &json); 988 base::JSONWriter::Write(&jwk_dict, &json);
990 buffer->assign(json.data(), json.data() + json.size()); 989 buffer->assign(json.data(), json.data() + json.size());
991 return Status::Success(); 990 return Status::Success();
992 } 991 }
993 992
994 } // namespace webcrypto 993 } // namespace webcrypto
995 994
996 } // namespace content 995 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/child/webcrypto/webcrypto_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698