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

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: remove test for derivebits 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
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // the table below, and describes the operations for which this key may be 64 // the table below, and describes the operations for which this key may be
65 // used. 65 // used.
66 // +-------+--------------------------------------------------------------+ 66 // +-------+--------------------------------------------------------------+
67 // | "encrypt" | encrypt operations | 67 // | "encrypt" | encrypt operations |
68 // | "decrypt" | decrypt operations | 68 // | "decrypt" | decrypt operations |
69 // | "sign" | sign (MAC) operations | 69 // | "sign" | sign (MAC) operations |
70 // | "verify" | verify (MAC) operations | 70 // | "verify" | verify (MAC) operations |
71 // | "wrapKey" | key wrap | 71 // | "wrapKey" | key wrap |
72 // | "unwrapKey" | key unwrap | 72 // | "unwrapKey" | key unwrap |
73 // | "deriveKey" | key derivation | 73 // | "deriveKey" | key derivation |
74 // | "deriveBits" | key derivation TODO(padolph): not currently supported | 74 // | "deriveBits" | key derivation |
75 // +-------+--------------------------------------------------------------+ 75 // +-------+--------------------------------------------------------------+
76 // 76 //
77 // - use (Key Use) 77 // - use (Key Use)
78 // The use field contains a single entry from the table below. 78 // The use field contains a single entry from the table below.
79 // +-------+--------------------------------------------------------------+ 79 // +-------+--------------------------------------------------------------+
80 // | "sig" | equivalent to key_ops of [sign, verify] | 80 // | "sig" | equivalent to key_ops of [sign, verify] |
81 // | "enc" | equivalent to key_ops of [encrypt, decrypt, wrapKey, | 81 // | "enc" | equivalent to key_ops of [encrypt, decrypt, wrapKey, |
82 // | | unwrapKey, deriveKey, deriveBits] | 82 // | | unwrapKey, deriveKey, deriveBits] |
83 // +-------+--------------------------------------------------------------+ 83 // +-------+--------------------------------------------------------------+
84 // 84 //
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 // Creates an RSA-OAEP algorithm. It is an error to call this with a hash_id 193 // Creates an RSA-OAEP algorithm. It is an error to call this with a hash_id
194 // that is not a SHA*. 194 // that is not a SHA*.
195 blink::WebCryptoAlgorithm CreateRsaOaepImportAlgorithm( 195 blink::WebCryptoAlgorithm CreateRsaOaepImportAlgorithm(
196 blink::WebCryptoAlgorithmId hash_id) { 196 blink::WebCryptoAlgorithmId hash_id) {
197 return CreateRsaHashedImportAlgorithm(blink::WebCryptoAlgorithmIdRsaOaep, 197 return CreateRsaHashedImportAlgorithm(blink::WebCryptoAlgorithmIdRsaOaep,
198 hash_id); 198 hash_id);
199 } 199 }
200 200
201 // Web Crypto equivalent usage mask for JWK 'use' = 'enc'. 201 // Web Crypto equivalent usage mask for JWK 'use' = 'enc'.
202 // TODO(padolph): Add 'deriveBits' once supported by Blink.
203 const blink::WebCryptoKeyUsageMask kJwkEncUsage = 202 const blink::WebCryptoKeyUsageMask kJwkEncUsage =
204 blink::WebCryptoKeyUsageEncrypt | blink::WebCryptoKeyUsageDecrypt | 203 blink::WebCryptoKeyUsageEncrypt | blink::WebCryptoKeyUsageDecrypt |
205 blink::WebCryptoKeyUsageWrapKey | blink::WebCryptoKeyUsageUnwrapKey | 204 blink::WebCryptoKeyUsageWrapKey | blink::WebCryptoKeyUsageUnwrapKey |
206 blink::WebCryptoKeyUsageDeriveKey; 205 blink::WebCryptoKeyUsageDeriveKey | blink::WebCryptoKeyUsageDeriveBits;
207 // Web Crypto equivalent usage mask for JWK 'use' = 'sig'. 206 // Web Crypto equivalent usage mask for JWK 'use' = 'sig'.
208 const blink::WebCryptoKeyUsageMask kJwkSigUsage = 207 const blink::WebCryptoKeyUsageMask kJwkSigUsage =
209 blink::WebCryptoKeyUsageSign | blink::WebCryptoKeyUsageVerify; 208 blink::WebCryptoKeyUsageSign | blink::WebCryptoKeyUsageVerify;
210 209
211 typedef blink::WebCryptoAlgorithm (*AlgorithmCreationFunc)(); 210 typedef blink::WebCryptoAlgorithm (*AlgorithmCreationFunc)();
212 211
213 class JwkAlgorithmInfo { 212 class JwkAlgorithmInfo {
214 public: 213 public:
215 JwkAlgorithmInfo() 214 JwkAlgorithmInfo()
216 : creation_func_(NULL), 215 : creation_func_(NULL),
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 827
829 std::string json; 828 std::string json;
830 base::JSONWriter::Write(&jwk_dict, &json); 829 base::JSONWriter::Write(&jwk_dict, &json);
831 buffer->assign(json.data(), json.data() + json.size()); 830 buffer->assign(json.data(), json.data() + json.size());
832 return Status::Success(); 831 return Status::Success();
833 } 832 }
834 833
835 } // namespace webcrypto 834 } // namespace webcrypto
836 835
837 } // namespace content 836 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/child/webcrypto/shared_crypto_unittest.cc » ('j') | content/child/webcrypto/shared_crypto_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698