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

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

Issue 698363002: webcrypto: Add ECDSA algorithm (chromium-side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@extract_more
Patch Set: sigh, more android pedantry Created 6 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 2014 The Chromium Authors. All rights reserved. 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 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_CHILD_WEBCRYPTO_OPENSSL_RSA_KEY_OPENSSL_H_ 5 #ifndef CONTENT_CHILD_WEBCRYPTO_OPENSSL_EC_KEY_OPENSSL_H_
6 #define CONTENT_CHILD_WEBCRYPTO_OPENSSL_RSA_KEY_OPENSSL_H_ 6 #define CONTENT_CHILD_WEBCRYPTO_OPENSSL_EC_KEY_OPENSSL_H_
7 7
8 #include "content/child/webcrypto/algorithm_implementation.h" 8 #include "content/child/webcrypto/algorithm_implementation.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 namespace webcrypto { 12 namespace webcrypto {
13 13
14 // Base class for an RSA algorithm whose keys additionaly have a hash parameter 14 // Base class for an EC algorithm. Provides functionality for generating,
15 // bound to them. Provides functionality for generating, importing, and 15 // importing, and exporting keys.
16 // exporting keys. 16 class EcAlgorithm : public AlgorithmImplementation {
17 class RsaHashedAlgorithm : public AlgorithmImplementation {
18 public: 17 public:
19 // |all_public_key_usages| and |all_private_key_usages| are the set of 18 // |all_public_key_usages| and |all_private_key_usages| are the set of
20 // WebCrypto key usages that are valid for created keys (public and private 19 // WebCrypto key usages that are valid for created keys (public and private
21 // respectively). 20 // respectively).
22 // 21 EcAlgorithm(blink::WebCryptoKeyUsageMask all_public_key_usages,
23 // For instance if public keys support encryption and wrapping, and private 22 blink::WebCryptoKeyUsageMask all_private_key_usages)
24 // keys support decryption and unwrapping callers should set:
25 // all_public_key_usages = UsageEncrypt | UsageWrap
26 // all_private_key_usages = UsageDecrypt | UsageUnwrap
27 // This information is used when importing or generating keys, to enforce
28 // that valid key usages are allowed.
29 RsaHashedAlgorithm(blink::WebCryptoKeyUsageMask all_public_key_usages,
30 blink::WebCryptoKeyUsageMask all_private_key_usages)
31 : all_public_key_usages_(all_public_key_usages), 23 : all_public_key_usages_(all_public_key_usages),
32 all_private_key_usages_(all_private_key_usages) {} 24 all_private_key_usages_(all_private_key_usages) {}
33 25
34 // For instance "RSA-OAEP-256". 26 // For instance "ES256".
35 virtual const char* GetJwkAlgorithm( 27 virtual const char* GetJwkAlgorithm(
36 const blink::WebCryptoAlgorithmId hash) const = 0; 28 const blink::WebCryptoNamedCurve curve) const = 0;
37 29
38 Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm, 30 Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm,
39 bool extractable, 31 bool extractable,
40 blink::WebCryptoKeyUsageMask usages, 32 blink::WebCryptoKeyUsageMask usages,
41 GenerateKeyResult* result) const override; 33 GenerateKeyResult* result) const override;
42 34
43 Status VerifyKeyUsagesBeforeImportKey( 35 Status VerifyKeyUsagesBeforeImportKey(
44 blink::WebCryptoKeyFormat format, 36 blink::WebCryptoKeyFormat format,
45 blink::WebCryptoKeyUsageMask usages) const override; 37 blink::WebCryptoKeyUsageMask usages) const override;
46 38
(...skipping 29 matching lines...) Expand all
76 blink::WebVector<uint8_t>* key_data) const override; 68 blink::WebVector<uint8_t>* key_data) const override;
77 69
78 Status DeserializeKeyForClone(const blink::WebCryptoKeyAlgorithm& algorithm, 70 Status DeserializeKeyForClone(const blink::WebCryptoKeyAlgorithm& algorithm,
79 blink::WebCryptoKeyType type, 71 blink::WebCryptoKeyType type,
80 bool extractable, 72 bool extractable,
81 blink::WebCryptoKeyUsageMask usages, 73 blink::WebCryptoKeyUsageMask usages,
82 const CryptoData& key_data, 74 const CryptoData& key_data,
83 blink::WebCryptoKey* key) const override; 75 blink::WebCryptoKey* key) const override;
84 76
85 private: 77 private:
86 blink::WebCryptoKeyUsageMask all_public_key_usages_; 78 const blink::WebCryptoKeyUsageMask all_public_key_usages_;
87 blink::WebCryptoKeyUsageMask all_private_key_usages_; 79 const blink::WebCryptoKeyUsageMask all_private_key_usages_;
88 }; 80 };
89 81
90 } // namespace webcrypto 82 } // namespace webcrypto
91 83
92 } // namespace content 84 } // namespace content
93 85
94 #endif // CONTENT_CHILD_WEBCRYPTO_OPENSSL_RSA_KEY_OPENSSL_H_ 86 #endif // CONTENT_CHILD_WEBCRYPTO_OPENSSL_EC_KEY_OPENSSL_H_
OLDNEW
« no previous file with comments | « content/child/webcrypto/nss/util_nss.cc ('k') | content/child/webcrypto/openssl/ec_key_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698