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

Side by Side Diff: public/platform/WebCryptoKeyAlgorithmParams.h

Issue 284973002: [webcrypto] Remove RSA-ES support (3 of 3) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Placate compiler warning on android about uninitialized variable Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « public/platform/WebCryptoKeyAlgorithm.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 23 matching lines...) Expand all
34 #include "WebCommon.h" 34 #include "WebCommon.h"
35 #include "WebCryptoAlgorithm.h" 35 #include "WebCryptoAlgorithm.h"
36 #include "WebVector.h" 36 #include "WebVector.h"
37 37
38 namespace blink { 38 namespace blink {
39 39
40 enum WebCryptoKeyAlgorithmParamsType { 40 enum WebCryptoKeyAlgorithmParamsType {
41 WebCryptoKeyAlgorithmParamsTypeNone, 41 WebCryptoKeyAlgorithmParamsTypeNone,
42 WebCryptoKeyAlgorithmParamsTypeHmac, 42 WebCryptoKeyAlgorithmParamsTypeHmac,
43 WebCryptoKeyAlgorithmParamsTypeAes, 43 WebCryptoKeyAlgorithmParamsTypeAes,
44 WebCryptoKeyAlgorithmParamsTypeRsa,
45 WebCryptoKeyAlgorithmParamsTypeRsaHashed 44 WebCryptoKeyAlgorithmParamsTypeRsaHashed
46 }; 45 };
47 46
48 class WebCryptoKeyAlgorithmParams { 47 class WebCryptoKeyAlgorithmParams {
49 public: 48 public:
50 virtual ~WebCryptoKeyAlgorithmParams() { } 49 virtual ~WebCryptoKeyAlgorithmParams() { }
51 virtual WebCryptoKeyAlgorithmParamsType type() const 50 virtual WebCryptoKeyAlgorithmParamsType type() const
52 { 51 {
53 return WebCryptoKeyAlgorithmParamsTypeNone; 52 return WebCryptoKeyAlgorithmParamsTypeNone;
54 } 53 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 virtual WebCryptoKeyAlgorithmParamsType type() const 95 virtual WebCryptoKeyAlgorithmParamsType type() const
97 { 96 {
98 return WebCryptoKeyAlgorithmParamsTypeHmac; 97 return WebCryptoKeyAlgorithmParamsTypeHmac;
99 } 98 }
100 99
101 private: 100 private:
102 WebCryptoAlgorithm m_hash; 101 WebCryptoAlgorithm m_hash;
103 unsigned m_lengthBits; 102 unsigned m_lengthBits;
104 }; 103 };
105 104
106 class WebCryptoRsaKeyAlgorithmParams : public WebCryptoKeyAlgorithmParams { 105 class WebCryptoRsaHashedKeyAlgorithmParams : public WebCryptoKeyAlgorithmParams {
107 public: 106 public:
108 WebCryptoRsaKeyAlgorithmParams(unsigned modulusLengthBits, const unsigned ch ar* publicExponent, unsigned publicExponentSize) 107 WebCryptoRsaHashedKeyAlgorithmParams(unsigned modulusLengthBits, const unsig ned char* publicExponent, unsigned publicExponentSize, const WebCryptoAlgorithm& hash)
109 : m_modulusLengthBits(modulusLengthBits) 108 : m_modulusLengthBits(modulusLengthBits)
110 , m_publicExponent(publicExponent, publicExponentSize) 109 , m_publicExponent(publicExponent, publicExponentSize)
110 , m_hash(hash)
111 { 111 {
112 } 112 }
113 113
114 unsigned modulusLengthBits() const 114 unsigned modulusLengthBits() const
115 { 115 {
116 return m_modulusLengthBits; 116 return m_modulusLengthBits;
117 } 117 }
118 118
119 const WebVector<unsigned char>& publicExponent() const 119 const WebVector<unsigned char>& publicExponent() const
120 { 120 {
121 return m_publicExponent; 121 return m_publicExponent;
122 } 122 }
123 123
124 virtual WebCryptoKeyAlgorithmParamsType type() const
125 {
126 return WebCryptoKeyAlgorithmParamsTypeRsa;
127 }
128
129 private:
130 unsigned m_modulusLengthBits;
131 WebVector<unsigned char> m_publicExponent;
132 };
133
134 class WebCryptoRsaHashedKeyAlgorithmParams : public WebCryptoRsaKeyAlgorithmPara ms {
135 public:
136 WebCryptoRsaHashedKeyAlgorithmParams(unsigned modulusLengthBits, const unsig ned char* publicExponent, unsigned publicExponentSize, const WebCryptoAlgorithm& hash)
137 : WebCryptoRsaKeyAlgorithmParams(modulusLengthBits, publicExponent, publ icExponentSize)
138 , m_hash(hash)
139 {
140 }
141
142 const WebCryptoAlgorithm& hash() const 124 const WebCryptoAlgorithm& hash() const
143 { 125 {
144 return m_hash; 126 return m_hash;
145 } 127 }
146 128
147 virtual WebCryptoKeyAlgorithmParamsType type() const 129 virtual WebCryptoKeyAlgorithmParamsType type() const
148 { 130 {
149 return WebCryptoKeyAlgorithmParamsTypeRsaHashed; 131 return WebCryptoKeyAlgorithmParamsTypeRsaHashed;
150 } 132 }
151 133
152 private: 134 private:
135 unsigned m_modulusLengthBits;
136 WebVector<unsigned char> m_publicExponent;
153 WebCryptoAlgorithm m_hash; 137 WebCryptoAlgorithm m_hash;
154 }; 138 };
155 139
156 } // namespace blink 140 } // namespace blink
157 141
158 #endif 142 #endif
OLDNEW
« no previous file with comments | « public/platform/WebCryptoKeyAlgorithm.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698