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

Side by Side Diff: components/webcrypto/openssl/ec_algorithm_openssl.h

Issue 1304063015: [refactor] Rename the webcrypto/openssl and webcrypto/test directories. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@jwk_refactor
Patch Set: Created 5 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
(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 COMPONENTS_WEBCRYPTO_OPENSSL_EC_ALGORITHM_OPENSSL_H_
6 #define COMPONENTS_WEBCRYPTO_OPENSSL_EC_ALGORITHM_OPENSSL_H_
7
8 #include "components/webcrypto/algorithm_implementation.h"
9
10 namespace webcrypto {
11
12 // Base class for an EC algorithm. Provides functionality for generating,
13 // importing, and exporting keys.
14 class EcAlgorithm : public AlgorithmImplementation {
15 public:
16 // |all_public_key_usages| and |all_private_key_usages| are the set of
17 // WebCrypto key usages that are valid for created keys (public and private
18 // respectively).
19 EcAlgorithm(blink::WebCryptoKeyUsageMask all_public_key_usages,
20 blink::WebCryptoKeyUsageMask all_private_key_usages)
21 : all_public_key_usages_(all_public_key_usages),
22 all_private_key_usages_(all_private_key_usages) {}
23
24 // For instance "ES256".
25 virtual const char* GetJwkAlgorithm(
26 const blink::WebCryptoNamedCurve curve) const = 0;
27
28 Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm,
29 bool extractable,
30 blink::WebCryptoKeyUsageMask usages,
31 GenerateKeyResult* result) const override;
32
33 Status VerifyKeyUsagesBeforeImportKey(
34 blink::WebCryptoKeyFormat format,
35 blink::WebCryptoKeyUsageMask usages) const override;
36
37 Status ImportKeyPkcs8(const CryptoData& key_data,
38 const blink::WebCryptoAlgorithm& algorithm,
39 bool extractable,
40 blink::WebCryptoKeyUsageMask usages,
41 blink::WebCryptoKey* key) const override;
42
43 Status ImportKeySpki(const CryptoData& key_data,
44 const blink::WebCryptoAlgorithm& algorithm,
45 bool extractable,
46 blink::WebCryptoKeyUsageMask usages,
47 blink::WebCryptoKey* key) const override;
48
49 Status ImportKeyJwk(const CryptoData& key_data,
50 const blink::WebCryptoAlgorithm& algorithm,
51 bool extractable,
52 blink::WebCryptoKeyUsageMask usages,
53 blink::WebCryptoKey* key) const override;
54
55 Status ExportKeyPkcs8(const blink::WebCryptoKey& key,
56 std::vector<uint8_t>* buffer) const override;
57
58 Status ExportKeySpki(const blink::WebCryptoKey& key,
59 std::vector<uint8_t>* buffer) const override;
60
61 Status ExportKeyJwk(const blink::WebCryptoKey& key,
62 std::vector<uint8_t>* buffer) const override;
63
64 Status SerializeKeyForClone(
65 const blink::WebCryptoKey& key,
66 blink::WebVector<uint8_t>* key_data) const override;
67
68 Status DeserializeKeyForClone(const blink::WebCryptoKeyAlgorithm& algorithm,
69 blink::WebCryptoKeyType type,
70 bool extractable,
71 blink::WebCryptoKeyUsageMask usages,
72 const CryptoData& key_data,
73 blink::WebCryptoKey* key) const override;
74
75 private:
76 const blink::WebCryptoKeyUsageMask all_public_key_usages_;
77 const blink::WebCryptoKeyUsageMask all_private_key_usages_;
78 };
79
80 } // namespace webcrypto
81
82 #endif // COMPONENTS_WEBCRYPTO_OPENSSL_EC_ALGORITHM_OPENSSL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698