equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 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 |
121 } |
121 } |
122 if (params == null) { |
122 if (params == null) { |
123 // generate default for salt and iteration count if necessary |
123 // generate default for salt and iteration count if necessary |
124 if (salt == null) { |
124 if (salt == null) { |
125 salt = new byte[DEFAULT_SALT_LENGTH]; |
125 salt = new byte[DEFAULT_SALT_LENGTH]; |
126 SunJCE.RANDOM.nextBytes(salt); |
126 SunJCE.getRandom().nextBytes(salt); |
127 } |
127 } |
128 if (iCount == 0) iCount = DEFAULT_COUNT; |
128 if (iCount == 0) iCount = DEFAULT_COUNT; |
129 } else if (!(params instanceof PBEParameterSpec)) { |
129 } else if (!(params instanceof PBEParameterSpec)) { |
130 throw new InvalidAlgorithmParameterException |
130 throw new InvalidAlgorithmParameterException |
131 ("PBEParameterSpec type required"); |
131 ("PBEParameterSpec type required"); |