1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
80 * providers supply a SecureRandom implementation).
81 * </ul>
82 *
83 * <p>In case the client does not explicitly initialize the KeyGenerator
84 * (via a call to an {@code init} method), each provider must
85 * supply (and document) a default initialization.
86 * See the Keysize Restriction sections of the
87 * {@extLink security_guide_jdk_providers JDK Providers}
88 * document for information on the KeyGenerator defaults used by
89 * JDK providers.
90 * However, note that defaults may vary across different providers.
91 * Additionally, the default value for a provider may change in a future
92 * version. Therefore, it is recommended to explicitly initialize the
93 * KeyGenerator instead of relying on provider-specific defaults.
94 *
95 * <p> Every implementation of the Java platform is required to support the
96 * following standard {@code KeyGenerator} algorithms with the keysizes in
97 * parentheses:
98 * <ul>
99 * <li>{@code AES} (128)</li>
100 * <li>{@code DES} (56)</li>
101 * <li>{@code DESede} (168)</li>
102 * <li>{@code HmacSHA1}</li>
103 * <li>{@code HmacSHA256}</li>
104 * </ul>
105 * These algorithms are described in the <a href=
106 * "{@docRoot}/../specs/security/standard-names.html#keygenerator-algorithms">
107 * KeyGenerator section</a> of the
108 * Java Security Standard Algorithm Names Specification.
109 * Consult the release documentation for your implementation to see if any
110 * other algorithms are supported.
111 *
112 * @author Jan Luehe
113 *
114 * @see SecretKey
115 * @since 1.4
116 */
117
118 public class KeyGenerator {
119
120 private static final Debug pdebug =
|
1 /*
2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
80 * providers supply a SecureRandom implementation).
81 * </ul>
82 *
83 * <p>In case the client does not explicitly initialize the KeyGenerator
84 * (via a call to an {@code init} method), each provider must
85 * supply (and document) a default initialization.
86 * See the Keysize Restriction sections of the
87 * {@extLink security_guide_jdk_providers JDK Providers}
88 * document for information on the KeyGenerator defaults used by
89 * JDK providers.
90 * However, note that defaults may vary across different providers.
91 * Additionally, the default value for a provider may change in a future
92 * version. Therefore, it is recommended to explicitly initialize the
93 * KeyGenerator instead of relying on provider-specific defaults.
94 *
95 * <p> Every implementation of the Java platform is required to support the
96 * following standard {@code KeyGenerator} algorithms with the keysizes in
97 * parentheses:
98 * <ul>
99 * <li>{@code AES} (128)</li>
100 * <li>{@code DESede} (168)</li>
101 * <li>{@code HmacSHA1}</li>
102 * <li>{@code HmacSHA256}</li>
103 * </ul>
104 * These algorithms are described in the <a href=
105 * "{@docRoot}/../specs/security/standard-names.html#keygenerator-algorithms">
106 * KeyGenerator section</a> of the
107 * Java Security Standard Algorithm Names Specification.
108 * Consult the release documentation for your implementation to see if any
109 * other algorithms are supported.
110 *
111 * @author Jan Luehe
112 *
113 * @see SecretKey
114 * @since 1.4
115 */
116
117 public class KeyGenerator {
118
119 private static final Debug pdebug =
|