0N/A/*
2362N/A * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.security;
0N/A
0N/Aimport java.security.spec.AlgorithmParameterSpec;
0N/A
0N/A/**
0N/A * <p> This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
0N/A * for the <code>KeyPairGenerator</code> class, which is used to generate
0N/A * pairs of public and private keys.
0N/A *
0N/A * <p> All the abstract methods in this class must be implemented by each
0N/A * cryptographic service provider who wishes to supply the implementation
0N/A * of a key pair generator for a particular algorithm.
0N/A *
0N/A * <p> In case the client does not explicitly initialize the KeyPairGenerator
0N/A * (via a call to an <code>initialize</code> method), each provider must
0N/A * supply (and document) a default initialization.
0N/A * For example, the <i>Sun</i> provider uses a default modulus size (keysize)
0N/A * of 1024 bits.
0N/A *
0N/A * @author Benjamin Renaud
0N/A *
0N/A *
0N/A * @see KeyPairGenerator
0N/A * @see java.security.spec.AlgorithmParameterSpec
0N/A */
0N/A
0N/Apublic abstract class KeyPairGeneratorSpi {
0N/A
0N/A /**
0N/A * Initializes the key pair generator for a certain keysize, using
0N/A * the default parameter set.
0N/A *
0N/A * @param keysize the keysize. This is an
0N/A * algorithm-specific metric, such as modulus length, specified in
0N/A * number of bits.
0N/A *
0N/A * @param random the source of randomness for this generator.
0N/A *
0N/A * @exception InvalidParameterException if the <code>keysize</code> is not
0N/A * supported by this KeyPairGeneratorSpi object.
0N/A */
0N/A public abstract void initialize(int keysize, SecureRandom random);
0N/A
0N/A /**
0N/A * Initializes the key pair generator using the specified parameter
0N/A * set and user-provided source of randomness.
0N/A *
0N/A * <p>This concrete method has been added to this previously-defined
0N/A * abstract class. (For backwards compatibility, it cannot be abstract.)
0N/A * It may be overridden by a provider to initialize the key pair
0N/A * generator. Such an override
0N/A * is expected to throw an InvalidAlgorithmParameterException if
0N/A * a parameter is inappropriate for this key pair generator.
0N/A * If this method is not overridden, it always throws an
0N/A * UnsupportedOperationException.
0N/A *
0N/A * @param params the parameter set used to generate the keys.
0N/A *
0N/A * @param random the source of randomness for this generator.
0N/A *
0N/A * @exception InvalidAlgorithmParameterException if the given parameters
0N/A * are inappropriate for this key pair generator.
0N/A *
0N/A * @since 1.2
0N/A */
0N/A public void initialize(AlgorithmParameterSpec params,
0N/A SecureRandom random)
0N/A throws InvalidAlgorithmParameterException {
0N/A throw new UnsupportedOperationException();
0N/A }
0N/A
0N/A /**
0N/A * Generates a key pair. Unless an initialization method is called
0N/A * using a KeyPairGenerator interface, algorithm-specific defaults
0N/A * will be used. This will generate a new key pair every time it
0N/A * is called.
0N/A *
0N/A * @return the newly generated <tt>KeyPair</tt>
0N/A */
0N/A public abstract KeyPair generateKeyPair();
0N/A}