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

Side by Side Diff: content/child/webcrypto/openssl/ec_algorithm_openssl.h

Issue 1077273002: html_viewer: Move webcrypto to a place where html_viewer can use it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT Created 5 years, 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_CHILD_WEBCRYPTO_OPENSSL_EC_ALGORITHM_OPENSSL_H_
6 #define CONTENT_CHILD_WEBCRYPTO_OPENSSL_EC_ALGORITHM_OPENSSL_H_
7
8 #include "content/child/webcrypto/algorithm_implementation.h"
9
10 namespace content {
11
12 namespace webcrypto {
13
14 // Base class for an EC algorithm. Provides functionality for generating,
15 // importing, and exporting keys.
16 class EcAlgorithm : public AlgorithmImplementation {
17 public:
18 // |all_public_key_usages| and |all_private_key_usages| are the set of
19 // WebCrypto key usages that are valid for created keys (public and private
20 // respectively).
21 EcAlgorithm(blink::WebCryptoKeyUsageMask all_public_key_usages,
22 blink::WebCryptoKeyUsageMask all_private_key_usages)
23 : all_public_key_usages_(all_public_key_usages),
24 all_private_key_usages_(all_private_key_usages) {}
25
26 // For instance "ES256".
27 virtual const char* GetJwkAlgorithm(
28 const blink::WebCryptoNamedCurve curve) const = 0;
29
30 Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm,
31 bool extractable,
32 blink::WebCryptoKeyUsageMask usages,
33 GenerateKeyResult* result) const override;
34
35 Status VerifyKeyUsagesBeforeImportKey(
36 blink::WebCryptoKeyFormat format,
37 blink::WebCryptoKeyUsageMask usages) const override;
38
39 Status ImportKeyPkcs8(const CryptoData& key_data,
40 const blink::WebCryptoAlgorithm& algorithm,
41 bool extractable,
42 blink::WebCryptoKeyUsageMask usages,
43 blink::WebCryptoKey* key) const override;
44
45 Status ImportKeySpki(const CryptoData& key_data,
46 const blink::WebCryptoAlgorithm& algorithm,
47 bool extractable,
48 blink::WebCryptoKeyUsageMask usages,
49 blink::WebCryptoKey* key) const override;
50
51 Status ImportKeyJwk(const CryptoData& key_data,
52 const blink::WebCryptoAlgorithm& algorithm,
53 bool extractable,
54 blink::WebCryptoKeyUsageMask usages,
55 blink::WebCryptoKey* key) const override;
56
57 Status ExportKeyPkcs8(const blink::WebCryptoKey& key,
58 std::vector<uint8_t>* buffer) const override;
59
60 Status ExportKeySpki(const blink::WebCryptoKey& key,
61 std::vector<uint8_t>* buffer) const override;
62
63 Status ExportKeyJwk(const blink::WebCryptoKey& key,
64 std::vector<uint8_t>* buffer) const override;
65
66 Status SerializeKeyForClone(
67 const blink::WebCryptoKey& key,
68 blink::WebVector<uint8_t>* key_data) const override;
69
70 Status DeserializeKeyForClone(const blink::WebCryptoKeyAlgorithm& algorithm,
71 blink::WebCryptoKeyType type,
72 bool extractable,
73 blink::WebCryptoKeyUsageMask usages,
74 const CryptoData& key_data,
75 blink::WebCryptoKey* key) const override;
76
77 private:
78 const blink::WebCryptoKeyUsageMask all_public_key_usages_;
79 const blink::WebCryptoKeyUsageMask all_private_key_usages_;
80 };
81
82 } // namespace webcrypto
83
84 } // namespace content
85
86 #endif // CONTENT_CHILD_WEBCRYPTO_OPENSSL_EC_ALGORITHM_OPENSSL_H_
OLDNEW
« no previous file with comments | « content/child/webcrypto/openssl/aes_kw_openssl.cc ('k') | content/child/webcrypto/openssl/ec_algorithm_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698