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

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

Issue 23569007: WebCrypto: Implement importKey() and sign() for HMAC in NSS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Another attempt to fix try errors. Created 7 years, 3 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_IMPL_H_ 5 #ifndef CONTENT_RENDERER_WEBCRYPTO_IMPL_H_
6 #define CONTENT_RENDERER_WEBCRYPTO_IMPL_H_ 6 #define CONTENT_RENDERER_WEBCRYPTO_IMPL_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "base/memory/scoped_ptr.h"
11 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
12 #include "third_party/WebKit/public/platform/WebCrypto.h" 13 #include "third_party/WebKit/public/platform/WebCrypto.h"
13 14
14 namespace content { 15 namespace content {
15 16
16 class CONTENT_EXPORT WebCryptoImpl 17 class CONTENT_EXPORT WebCryptoImpl
17 : NON_EXPORTED_BASE(public WebKit::WebCrypto) { 18 : NON_EXPORTED_BASE(public WebKit::WebCrypto) {
18 public: 19 public:
19 virtual void digest( 20 virtual void digest(
20 const WebKit::WebCryptoAlgorithm& algorithm, 21 const WebKit::WebCryptoAlgorithm& algorithm,
21 const unsigned char* data, 22 const unsigned char* data,
22 #ifdef WEBCRYPTO_DIGEST_LENGTH_IS_UINT 23 #ifdef WEBCRYPTO_DIGEST_LENGTH_IS_UINT
23 unsigned data_size, 24 unsigned data_size,
24 #else 25 #else
25 size_t data_size, 26 size_t data_size,
26 #endif 27 #endif
27 WebKit::WebCryptoResult result); 28 WebKit::WebCryptoResult result);
29 virtual void importKey(
30 WebKit::WebCryptoKeyFormat format,
31 const unsigned char* key_data,
32 unsigned key_data_size,
33 const WebKit::WebCryptoAlgorithm& algorithm,
34 bool extractable,
35 WebKit::WebCryptoKeyUsageMask usage_mask,
36 WebKit::WebCryptoResult result);
37 virtual void sign(
38 const WebKit::WebCryptoAlgorithm& algorithm,
39 const WebKit::WebCryptoKey& key,
40 const unsigned char* data,
41 unsigned data_size,
42 WebKit::WebCryptoResult result);
28 43
29 protected: 44 protected:
30 FRIEND_TEST_ALL_PREFIXES(WebCryptoImplTest, DigestSampleSets); 45 FRIEND_TEST_ALL_PREFIXES(WebCryptoImplTest, DigestSampleSets);
46 FRIEND_TEST_ALL_PREFIXES(WebCryptoImplTest, HMACSampleSets);
31 47
32 bool DigestInternal( 48 bool DigestInternal(
33 const WebKit::WebCryptoAlgorithm& algorithm, 49 const WebKit::WebCryptoAlgorithm& algorithm,
34 const unsigned char* data, 50 const unsigned char* data,
35 unsigned data_size, 51 unsigned data_size,
36 WebKit::WebArrayBuffer* buffer); 52 WebKit::WebArrayBuffer* buffer);
53 bool ImportKeyInternal(
54 WebKit::WebCryptoKeyFormat format,
55 const unsigned char* key_data,
56 unsigned key_data_size,
57 const WebKit::WebCryptoAlgorithm& algorithm,
58 WebKit::WebCryptoKeyUsageMask usage_mask,
59 scoped_ptr<WebKit::WebCryptoKeyHandle>* handle,
60 WebKit::WebCryptoKeyType* type);
61 bool SignInternal(
62 const WebKit::WebCryptoAlgorithm& algorithm,
63 const WebKit::WebCryptoKeyHandle* key,
64 const unsigned char* data,
65 unsigned data_size,
66 WebKit::WebArrayBuffer* buffer);
37 }; 67 };
38 68
39 } // namespace content 69 } // namespace content
40 70
41 #endif // CONTENT_RENDERER_WEBCRYPTO_IMPL_H_ 71 #endif // CONTENT_RENDERER_WEBCRYPTO_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/webcrypto_impl.cc » ('j') | content/renderer/webcrypto_impl_nss.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698