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

Side by Side Diff: components/webcrypto/openssl/rsa_hashed_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_RSA_HASHED_ALGORITHM_OPENSSL_H_
6 #define COMPONENTS_WEBCRYPTO_OPENSSL_RSA_HASHED_ALGORITHM_OPENSSL_H_
7
8 #include "components/webcrypto/algorithm_implementation.h"
9
10 namespace webcrypto {
11
12 // Base class for an RSA algorithm whose keys additionaly have a hash parameter
13 // bound to them. Provides functionality for generating, importing, and
14 // exporting keys.
15 class RsaHashedAlgorithm : public AlgorithmImplementation {
16 public:
17 // |all_public_key_usages| and |all_private_key_usages| are the set of
18 // WebCrypto key usages that are valid for created keys (public and private
19 // respectively).
20 //
21 // For instance if public keys support encryption and wrapping, and private
22 // keys support decryption and unwrapping callers should set:
23 // all_public_key_usages = UsageEncrypt | UsageWrap
24 // all_private_key_usages = UsageDecrypt | UsageUnwrap
25 // This information is used when importing or generating keys, to enforce
26 // that valid key usages are allowed.
27 RsaHashedAlgorithm(blink::WebCryptoKeyUsageMask all_public_key_usages,
28 blink::WebCryptoKeyUsageMask all_private_key_usages)
29 : all_public_key_usages_(all_public_key_usages),
30 all_private_key_usages_(all_private_key_usages) {}
31
32 // For instance "RSA-OAEP-256".
33 virtual const char* GetJwkAlgorithm(
34 const blink::WebCryptoAlgorithmId hash) const = 0;
35
36 Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm,
37 bool extractable,
38 blink::WebCryptoKeyUsageMask usages,
39 GenerateKeyResult* result) const override;
40
41 Status VerifyKeyUsagesBeforeImportKey(
42 blink::WebCryptoKeyFormat format,
43 blink::WebCryptoKeyUsageMask usages) const override;
44
45 Status ImportKeyPkcs8(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 ImportKeySpki(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 ImportKeyJwk(const CryptoData& key_data,
58 const blink::WebCryptoAlgorithm& algorithm,
59 bool extractable,
60 blink::WebCryptoKeyUsageMask usages,
61 blink::WebCryptoKey* key) const override;
62
63 Status ExportKeyPkcs8(const blink::WebCryptoKey& key,
64 std::vector<uint8_t>* buffer) const override;
65
66 Status ExportKeySpki(const blink::WebCryptoKey& key,
67 std::vector<uint8_t>* buffer) const override;
68
69 Status ExportKeyJwk(const blink::WebCryptoKey& key,
70 std::vector<uint8_t>* buffer) const override;
71
72 Status SerializeKeyForClone(
73 const blink::WebCryptoKey& key,
74 blink::WebVector<uint8_t>* key_data) const override;
75
76 Status DeserializeKeyForClone(const blink::WebCryptoKeyAlgorithm& algorithm,
77 blink::WebCryptoKeyType type,
78 bool extractable,
79 blink::WebCryptoKeyUsageMask usages,
80 const CryptoData& key_data,
81 blink::WebCryptoKey* key) const override;
82
83 private:
84 const blink::WebCryptoKeyUsageMask all_public_key_usages_;
85 const blink::WebCryptoKeyUsageMask all_private_key_usages_;
86 };
87
88 } // namespace webcrypto
89
90 #endif // COMPONENTS_WEBCRYPTO_OPENSSL_RSA_HASHED_ALGORITHM_OPENSSL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698