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

Side by Side Diff: content/renderer/webcrypto/webcrypto_impl.h

Issue 25906002: [webcrypto] Add JWK import for HMAC and AES-CBC key. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: re-upload Created 7 years, 2 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_ 5 #ifndef CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_
6 #define CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_ 6 #define CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_
7 7
8 #include <map>
9 #include <string>
8 #include "base/basictypes.h" 10 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
11 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
12 #include "third_party/WebKit/public/platform/WebCrypto.h" 14 #include "third_party/WebKit/public/platform/WebCrypto.h"
13 15
14 namespace content { 16 namespace content {
15 17
16 class CONTENT_EXPORT WebCryptoImpl 18 class CONTENT_EXPORT WebCryptoImpl
17 : NON_EXPORTED_BASE(public WebKit::WebCrypto) { 19 : NON_EXPORTED_BASE(public WebKit::WebCrypto) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 const WebKit::WebCryptoKey& key, 61 const WebKit::WebCryptoKey& key,
60 const unsigned char* signature, 62 const unsigned char* signature,
61 unsigned signature_size, 63 unsigned signature_size,
62 const unsigned char* data, 64 const unsigned char* data,
63 unsigned data_size, 65 unsigned data_size,
64 WebKit::WebCryptoResult result); 66 WebKit::WebCryptoResult result);
65 67
66 protected: 68 protected:
67 friend class WebCryptoImplTest; 69 friend class WebCryptoImplTest;
68 70
71 std::map<std::string, int> jwk_algorithm_map_;
72
69 void Init(); 73 void Init();
70 74
71 bool EncryptInternal( 75 bool EncryptInternal(
72 const WebKit::WebCryptoAlgorithm& algorithm, 76 const WebKit::WebCryptoAlgorithm& algorithm,
73 const WebKit::WebCryptoKey& key, 77 const WebKit::WebCryptoKey& key,
74 const unsigned char* data, 78 const unsigned char* data,
75 unsigned data_size, 79 unsigned data_size,
76 WebKit::WebArrayBuffer* buffer); 80 WebKit::WebArrayBuffer* buffer);
77 bool DecryptInternal( 81 bool DecryptInternal(
78 const WebKit::WebCryptoAlgorithm& algorithm, 82 const WebKit::WebCryptoAlgorithm& algorithm,
(...skipping 26 matching lines...) Expand all
105 WebKit::WebArrayBuffer* buffer); 109 WebKit::WebArrayBuffer* buffer);
106 bool VerifySignatureInternal( 110 bool VerifySignatureInternal(
107 const WebKit::WebCryptoAlgorithm& algorithm, 111 const WebKit::WebCryptoAlgorithm& algorithm,
108 const WebKit::WebCryptoKey& key, 112 const WebKit::WebCryptoKey& key,
109 const unsigned char* signature, 113 const unsigned char* signature,
110 unsigned signature_size, 114 unsigned signature_size,
111 const unsigned char* data, 115 const unsigned char* data,
112 unsigned data_size, 116 unsigned data_size,
113 bool* signature_match); 117 bool* signature_match);
114 118
119 bool ImportKeyJwk(
120 const unsigned char* key_data,
121 unsigned key_data_size,
122 bool extractable,
123 const WebKit::WebCryptoAlgorithm& algorithm,
124 WebKit::WebCryptoKeyUsageMask usage_mask,
125 scoped_ptr<WebKit::WebCryptoKeyHandle>* handle,
126 WebKit::WebCryptoKeyType* type);
127
115 private: 128 private:
116 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); 129 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl);
117 }; 130 };
118 131
119 } // namespace content 132 } // namespace content
120 133
121 #endif // CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_ 134 #endif // CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/webcrypto/webcrypto_impl.cc » ('j') | content/renderer/webcrypto/webcrypto_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698