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

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

Issue 179353002: [webcrypto] Add the KeyAlgorithm interface. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase yet again (another conflict) Created 6 years, 9 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/blink_platform.gypi ('k') | Source/platform/exported/WebCryptoKey.cpp » ('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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 101
102 const WebCryptoAesKeyGenParams* WebCryptoAlgorithm::aesKeyGenParams() const 102 const WebCryptoAesKeyGenParams* WebCryptoAlgorithm::aesKeyGenParams() const
103 { 103 {
104 ASSERT(!isNull()); 104 ASSERT(!isNull());
105 if (paramsType() == WebCryptoAlgorithmParamsTypeAesKeyGenParams) 105 if (paramsType() == WebCryptoAlgorithmParamsTypeAesKeyGenParams)
106 return static_cast<WebCryptoAesKeyGenParams*>(m_private->params.get()); 106 return static_cast<WebCryptoAesKeyGenParams*>(m_private->params.get());
107 return 0; 107 return 0;
108 } 108 }
109 109
110 const WebCryptoHmacParams* WebCryptoAlgorithm::hmacParams() const 110 const WebCryptoHmacImportParams* WebCryptoAlgorithm::hmacImportParams() const
111 { 111 {
112 ASSERT(!isNull()); 112 ASSERT(!isNull());
113 if (paramsType() == WebCryptoAlgorithmParamsTypeHmacParams) 113 if (paramsType() == WebCryptoAlgorithmParamsTypeHmacImportParams)
114 return static_cast<WebCryptoHmacParams*>(m_private->params.get()); 114 return static_cast<WebCryptoHmacImportParams*>(m_private->params.get());
115 return 0; 115 return 0;
116 } 116 }
117 117
118 const WebCryptoHmacKeyParams* WebCryptoAlgorithm::hmacKeyParams() const 118 const WebCryptoHmacKeyGenParams* WebCryptoAlgorithm::hmacKeyGenParams() const
119 { 119 {
120 ASSERT(!isNull()); 120 ASSERT(!isNull());
121 if (paramsType() == WebCryptoAlgorithmParamsTypeHmacKeyParams) 121 if (paramsType() == WebCryptoAlgorithmParamsTypeHmacKeyGenParams)
122 return static_cast<WebCryptoHmacKeyParams*>(m_private->params.get()); 122 return static_cast<WebCryptoHmacKeyGenParams*>(m_private->params.get());
123 return 0; 123 return 0;
124 } 124 }
125 125
126 const WebCryptoRsaSsaParams* WebCryptoAlgorithm::rsaSsaParams() const
127 {
128 ASSERT(!isNull());
129 if (paramsType() == WebCryptoAlgorithmParamsTypeRsaSsaParams)
130 return static_cast<WebCryptoRsaSsaParams*>(m_private->params.get());
131 return 0;
132 }
133
134 const WebCryptoRsaKeyGenParams* WebCryptoAlgorithm::rsaKeyGenParams() const 126 const WebCryptoRsaKeyGenParams* WebCryptoAlgorithm::rsaKeyGenParams() const
135 { 127 {
136 ASSERT(!isNull()); 128 ASSERT(!isNull());
137 if (paramsType() == WebCryptoAlgorithmParamsTypeRsaKeyGenParams) 129 if (paramsType() == WebCryptoAlgorithmParamsTypeRsaKeyGenParams)
138 return static_cast<WebCryptoRsaKeyGenParams*>(m_private->params.get()); 130 return static_cast<WebCryptoRsaKeyGenParams*>(m_private->params.get());
139 return 0; 131 return 0;
140 } 132 }
141 133
142 const WebCryptoAesGcmParams* WebCryptoAlgorithm::aesGcmParams() const 134 const WebCryptoAesGcmParams* WebCryptoAlgorithm::aesGcmParams() const
143 { 135 {
144 ASSERT(!isNull()); 136 ASSERT(!isNull());
145 if (paramsType() == WebCryptoAlgorithmParamsTypeAesGcmParams) 137 if (paramsType() == WebCryptoAlgorithmParamsTypeAesGcmParams)
146 return static_cast<WebCryptoAesGcmParams*>(m_private->params.get()); 138 return static_cast<WebCryptoAesGcmParams*>(m_private->params.get());
147 return 0; 139 return 0;
148 } 140 }
149 141
150 const WebCryptoRsaOaepParams* WebCryptoAlgorithm::rsaOaepParams() const 142 const WebCryptoRsaOaepParams* WebCryptoAlgorithm::rsaOaepParams() const
151 { 143 {
152 ASSERT(!isNull()); 144 ASSERT(!isNull());
153 if (paramsType() == WebCryptoAlgorithmParamsTypeRsaOaepParams) 145 if (paramsType() == WebCryptoAlgorithmParamsTypeRsaOaepParams)
154 return static_cast<WebCryptoRsaOaepParams*>(m_private->params.get()); 146 return static_cast<WebCryptoRsaOaepParams*>(m_private->params.get());
155 return 0; 147 return 0;
156 } 148 }
157 149
150 const WebCryptoRsaHashedImportParams* WebCryptoAlgorithm::rsaHashedImportParams( ) const
151 {
152 ASSERT(!isNull());
153 if (paramsType() == WebCryptoAlgorithmParamsTypeRsaHashedImportParams)
154 return static_cast<WebCryptoRsaHashedImportParams*>(m_private->params.ge t());
155 return 0;
156 }
157
158 const WebCryptoRsaHashedKeyGenParams* WebCryptoAlgorithm::rsaHashedKeyGenParams( ) const
159 {
160 ASSERT(!isNull());
161 if (paramsType() == WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams)
162 return static_cast<WebCryptoRsaHashedKeyGenParams*>(m_private->params.ge t());
163 return 0;
164 }
165
158 void WebCryptoAlgorithm::assign(const WebCryptoAlgorithm& other) 166 void WebCryptoAlgorithm::assign(const WebCryptoAlgorithm& other)
159 { 167 {
160 m_private = other.m_private; 168 m_private = other.m_private;
161 } 169 }
162 170
163 void WebCryptoAlgorithm::reset() 171 void WebCryptoAlgorithm::reset()
164 { 172 {
165 m_private.reset(); 173 m_private.reset();
166 } 174 }
167 175
168 } // namespace blink 176 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | Source/platform/exported/WebCryptoKey.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698