1 /* |
1 /* |
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
128 MGF1ParameterSpec.SHA256, PSource.PSpecified.DEFAULT)); |
128 MGF1ParameterSpec.SHA256, PSource.PSpecified.DEFAULT)); |
129 test(new OAEPParameterSpec("SHA-512", "MGF1", |
129 test(new OAEPParameterSpec("SHA-512", "MGF1", |
130 MGF1ParameterSpec.SHA384, PSource.PSpecified.DEFAULT)); |
130 MGF1ParameterSpec.SHA384, PSource.PSpecified.DEFAULT)); |
131 test(new OAEPParameterSpec("SHA-512", "MGF1", |
131 test(new OAEPParameterSpec("SHA-512", "MGF1", |
132 MGF1ParameterSpec.SHA512, PSource.PSpecified.DEFAULT)); |
132 MGF1ParameterSpec.SHA512, PSource.PSpecified.DEFAULT)); |
|
133 // SHA-512/224 and SHA-512/256 |
|
134 test(new OAEPParameterSpec("SHA-512/224", "MGF1", |
|
135 MGF1ParameterSpec.SHA224, PSource.PSpecified.DEFAULT)); |
|
136 test(new OAEPParameterSpec("SHA-512/224", "MGF1", |
|
137 MGF1ParameterSpec.SHA512_224, PSource.PSpecified.DEFAULT)); |
|
138 test(new OAEPParameterSpec("SHA-512/256", "MGF1", |
|
139 MGF1ParameterSpec.SHA384, PSource.PSpecified.DEFAULT)); |
|
140 test(new OAEPParameterSpec("SHA-512/256", "MGF1", |
|
141 MGF1ParameterSpec.SHA512, PSource.PSpecified.DEFAULT)); |
|
142 |
133 if (failed) { |
143 if (failed) { |
134 throw new Exception("Test failed"); |
144 throw new Exception("Test failed"); |
135 } |
145 } |
136 } |
146 } |
137 |
147 |
152 algo = spec.getDigestAlgorithm(); |
162 algo = spec.getDigestAlgorithm(); |
153 if (algo.equals("MD5")) { |
163 if (algo.equals("MD5")) { |
154 dlen = 16; |
164 dlen = 16; |
155 } else if (algo.equals("SHA1")) { |
165 } else if (algo.equals("SHA1")) { |
156 dlen = 20; |
166 dlen = 20; |
157 } else if (algo.equals("SHA-224")) { |
167 } else if (algo.equals("SHA-224") || algo.equals("SHA-512/224")) { |
158 dlen = 28; |
168 dlen = 28; |
159 } else if (algo.equals("SHA-256")) { |
169 } else if (algo.equals("SHA-256") || algo.equals("SHA-512/256")) { |
160 dlen = 32; |
170 dlen = 32; |
161 } else if (algo.equals("SHA-384")) { |
171 } else if (algo.equals("SHA-384")) { |
162 dlen = 48; |
172 dlen = 48; |
163 } else if (algo.equals("SHA-512")) { |
173 } else if (algo.equals("SHA-512")) { |
164 dlen = 64; |
174 dlen = 64; |