equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2002, 2013, 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. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
162 */ |
162 */ |
163 AlgorithmParameters getParameters() { |
163 AlgorithmParameters getParameters() { |
164 AlgorithmParameters params = null; |
164 AlgorithmParameters params = null; |
165 if (salt == null) { |
165 if (salt == null) { |
166 salt = new byte[8]; |
166 salt = new byte[8]; |
167 SunJCE.RANDOM.nextBytes(salt); |
167 SunJCE.getRandom().nextBytes(salt); |
168 } |
168 } |
169 PBEParameterSpec pbeSpec = new PBEParameterSpec(salt, iCount); |
169 PBEParameterSpec pbeSpec = new PBEParameterSpec(salt, iCount); |
170 try { |
170 try { |
171 params = AlgorithmParameters.getInstance("PBEWithMD5And" + |
171 params = AlgorithmParameters.getInstance("PBEWithMD5And" + |
172 (algo.equalsIgnoreCase("DES")? "DES":"TripleDES"), "SunJCE"); |
172 (algo.equalsIgnoreCase("DES")? "DES":"TripleDES"), "SunJCE"); |