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

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: rebase Created 7 years, 1 month 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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
11 #include "third_party/WebKit/public/platform/WebCrypto.h" 11 #include "third_party/WebKit/public/platform/WebCrypto.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 class CONTENT_EXPORT WebCryptoImpl 15 class CONTENT_EXPORT WebCryptoImpl
16 : NON_EXPORTED_BASE(public WebKit::WebCrypto) { 16 : NON_EXPORTED_BASE(public WebKit::WebCrypto) {
17 public: 17 public:
18 WebCryptoImpl(); 18 WebCryptoImpl();
19 virtual ~WebCryptoImpl();
19 20
20 virtual void encrypt( 21 virtual void encrypt(
21 const WebKit::WebCryptoAlgorithm& algorithm, 22 const WebKit::WebCryptoAlgorithm& algorithm,
22 const WebKit::WebCryptoKey& key, 23 const WebKit::WebCryptoKey& key,
23 const unsigned char* data, 24 const unsigned char* data,
24 unsigned data_size, 25 unsigned data_size,
25 WebKit::WebCryptoResult result); 26 WebKit::WebCryptoResult result);
26 virtual void decrypt( 27 virtual void decrypt(
27 const WebKit::WebCryptoAlgorithm& algorithm, 28 const WebKit::WebCryptoAlgorithm& algorithm,
28 const WebKit::WebCryptoKey& key, 29 const WebKit::WebCryptoKey& key,
(...skipping 26 matching lines...) Expand all
55 WebKit::WebCryptoResult result); 56 WebKit::WebCryptoResult result);
56 virtual void verifySignature( 57 virtual void verifySignature(
57 const WebKit::WebCryptoAlgorithm& algorithm, 58 const WebKit::WebCryptoAlgorithm& algorithm,
58 const WebKit::WebCryptoKey& key, 59 const WebKit::WebCryptoKey& key,
59 const unsigned char* signature, 60 const unsigned char* signature,
60 unsigned signature_size, 61 unsigned signature_size,
61 const unsigned char* data, 62 const unsigned char* data,
62 unsigned data_size, 63 unsigned data_size,
63 WebKit::WebCryptoResult result); 64 WebKit::WebCryptoResult result);
64 65
65 static void ShrinkBuffer(WebKit::WebArrayBuffer* buffer, unsigned new_size);
66 static WebKit::WebCryptoKey NullKey(); 66 static WebKit::WebCryptoKey NullKey();
67
68 protected: 67 protected:
69 friend class WebCryptoImplTest; 68 friend class WebCryptoImplTest;
70 69
71 void Init(); 70 void Init();
72 71
73 bool EncryptInternal( 72 bool EncryptInternal(
74 const WebKit::WebCryptoAlgorithm& algorithm, 73 const WebKit::WebCryptoAlgorithm& algorithm,
75 const WebKit::WebCryptoKey& key, 74 const WebKit::WebCryptoKey& key,
76 const unsigned char* data, 75 const unsigned char* data,
77 unsigned data_size, 76 unsigned data_size,
(...skipping 30 matching lines...) Expand all
108 WebKit::WebArrayBuffer* buffer); 107 WebKit::WebArrayBuffer* buffer);
109 bool VerifySignatureInternal( 108 bool VerifySignatureInternal(
110 const WebKit::WebCryptoAlgorithm& algorithm, 109 const WebKit::WebCryptoAlgorithm& algorithm,
111 const WebKit::WebCryptoKey& key, 110 const WebKit::WebCryptoKey& key,
112 const unsigned char* signature, 111 const unsigned char* signature,
113 unsigned signature_size, 112 unsigned signature_size,
114 const unsigned char* data, 113 const unsigned char* data,
115 unsigned data_size, 114 unsigned data_size,
116 bool* signature_match); 115 bool* signature_match);
117 116
117 bool ImportKeyJwk(
118 const unsigned char* key_data,
119 unsigned key_data_size,
120 const WebKit::WebCryptoAlgorithm& algorithm,
121 bool extractable,
122 WebKit::WebCryptoKeyUsageMask usage_mask,
123 WebKit::WebCryptoKey* key);
124
118 private: 125 private:
119 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); 126 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl);
120 }; 127 };
121 128
122 } // namespace content 129 } // namespace content
123 130
124 #endif // CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_ 131 #endif // CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698