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

Side by Side Diff: Source/platform/exported/WebCryptoKeyAlgorithm.cpp

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 | « Source/platform/exported/WebCryptoAlgorithm.cpp ('k') | public/platform/WebCryptoAlgorithm.h » ('j') | 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return WebCryptoKeyAlgorithm(id, adoptPtr(new WebCryptoAesKeyAlgorithmParams (keyLengthBits))); 73 return WebCryptoKeyAlgorithm(id, adoptPtr(new WebCryptoAesKeyAlgorithmParams (keyLengthBits)));
74 } 74 }
75 75
76 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createHmac(WebCryptoAlgorithmId has h, unsigned keyLengthBits) 76 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createHmac(WebCryptoAlgorithmId has h, unsigned keyLengthBits)
77 { 77 {
78 if (!WebCryptoAlgorithm::isHash(hash)) 78 if (!WebCryptoAlgorithm::isHash(hash))
79 return WebCryptoKeyAlgorithm(); 79 return WebCryptoKeyAlgorithm();
80 return WebCryptoKeyAlgorithm(WebCryptoAlgorithmIdHmac, adoptPtr(new WebCrypt oHmacKeyAlgorithmParams(createHash(hash), keyLengthBits))); 80 return WebCryptoKeyAlgorithm(WebCryptoAlgorithmIdHmac, adoptPtr(new WebCrypt oHmacKeyAlgorithmParams(createHash(hash), keyLengthBits)));
81 } 81 }
82 82
83 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createRsa(WebCryptoAlgorithmId id, unsigned modulusLengthBits, const unsigned char* publicExponent, unsigned public ExponentSize)
84 {
85 // FIXME: Verify that id is an RSA algorithm without a hash
86 return WebCryptoKeyAlgorithm(id, adoptPtr(new WebCryptoRsaKeyAlgorithmParams (modulusLengthBits, publicExponent, publicExponentSize)));
87 }
88
89 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createRsaHashed(WebCryptoAlgorithmI d id, unsigned modulusLengthBits, const unsigned char* publicExponent, unsigned publicExponentSize, WebCryptoAlgorithmId hash) 83 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createRsaHashed(WebCryptoAlgorithmI d id, unsigned modulusLengthBits, const unsigned char* publicExponent, unsigned publicExponentSize, WebCryptoAlgorithmId hash)
90 { 84 {
91 // FIXME: Verify that id is an RSA algorithm which expects a hash 85 // FIXME: Verify that id is an RSA algorithm which expects a hash
92 if (!WebCryptoAlgorithm::isHash(hash)) 86 if (!WebCryptoAlgorithm::isHash(hash))
93 return WebCryptoKeyAlgorithm(); 87 return WebCryptoKeyAlgorithm();
94 return WebCryptoKeyAlgorithm(id, adoptPtr(new WebCryptoRsaHashedKeyAlgorithm Params(modulusLengthBits, publicExponent, publicExponentSize, createHash(hash))) ); 88 return WebCryptoKeyAlgorithm(id, adoptPtr(new WebCryptoRsaHashedKeyAlgorithm Params(modulusLengthBits, publicExponent, publicExponentSize, createHash(hash))) );
95 } 89 }
96 90
97 bool WebCryptoKeyAlgorithm::isNull() const 91 bool WebCryptoKeyAlgorithm::isNull() const
98 { 92 {
(...skipping 23 matching lines...) Expand all
122 } 116 }
123 117
124 WebCryptoHmacKeyAlgorithmParams* WebCryptoKeyAlgorithm::hmacParams() const 118 WebCryptoHmacKeyAlgorithmParams* WebCryptoKeyAlgorithm::hmacParams() const
125 { 119 {
126 ASSERT(!isNull()); 120 ASSERT(!isNull());
127 if (paramsType() == WebCryptoKeyAlgorithmParamsTypeHmac) 121 if (paramsType() == WebCryptoKeyAlgorithmParamsTypeHmac)
128 return static_cast<WebCryptoHmacKeyAlgorithmParams*>(m_private->params.g et()); 122 return static_cast<WebCryptoHmacKeyAlgorithmParams*>(m_private->params.g et());
129 return 0; 123 return 0;
130 } 124 }
131 125
132 WebCryptoRsaKeyAlgorithmParams* WebCryptoKeyAlgorithm::rsaParams() const
133 {
134 ASSERT(!isNull());
135 if (paramsType() == WebCryptoKeyAlgorithmParamsTypeRsa || paramsType() == We bCryptoKeyAlgorithmParamsTypeRsaHashed)
136 return static_cast<WebCryptoRsaKeyAlgorithmParams*>(m_private->params.ge t());
137 return 0;
138 }
139
140 WebCryptoRsaHashedKeyAlgorithmParams* WebCryptoKeyAlgorithm::rsaHashedParams() c onst 126 WebCryptoRsaHashedKeyAlgorithmParams* WebCryptoKeyAlgorithm::rsaHashedParams() c onst
141 { 127 {
142 ASSERT(!isNull()); 128 ASSERT(!isNull());
143 if (paramsType() == WebCryptoKeyAlgorithmParamsTypeRsaHashed) 129 if (paramsType() == WebCryptoKeyAlgorithmParamsTypeRsaHashed)
144 return static_cast<WebCryptoRsaHashedKeyAlgorithmParams*>(m_private->par ams.get()); 130 return static_cast<WebCryptoRsaHashedKeyAlgorithmParams*>(m_private->par ams.get());
145 return 0; 131 return 0;
146 } 132 }
147 133
148 void WebCryptoKeyAlgorithm::assign(const WebCryptoKeyAlgorithm& other) 134 void WebCryptoKeyAlgorithm::assign(const WebCryptoKeyAlgorithm& other)
149 { 135 {
150 m_private = other.m_private; 136 m_private = other.m_private;
151 } 137 }
152 138
153 void WebCryptoKeyAlgorithm::reset() 139 void WebCryptoKeyAlgorithm::reset()
154 { 140 {
155 m_private.reset(); 141 m_private.reset();
156 } 142 }
157 143
158 } // namespace blink 144 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/exported/WebCryptoAlgorithm.cpp ('k') | public/platform/WebCryptoAlgorithm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698