0N/A/*
2362N/A * Copyright (c) 1997, 2004, 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.io.*;
0N/Aimport java.security.spec.AlgorithmParameterSpec;
0N/Aimport java.security.spec.InvalidParameterSpecException;
0N/A
0N/A/**
0N/A * This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
0N/A * for the <code>AlgorithmParameters</code> class, which is used to manage
0N/A * algorithm parameters.
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 parameter management
0N/A * for a particular algorithm.
0N/A *
0N/A * @author Jan Luehe
0N/A *
0N/A *
0N/A * @see AlgorithmParameters
0N/A * @see java.security.spec.AlgorithmParameterSpec
0N/A * @see java.security.spec.DSAParameterSpec
0N/A *
0N/A * @since 1.2
0N/A */
0N/A
0N/Apublic abstract class AlgorithmParametersSpi {
0N/A
0N/A /**
0N/A * Initializes this parameters object using the parameters
0N/A * specified in <code>paramSpec</code>.
0N/A *
0N/A * @param paramSpec the parameter specification.
0N/A *
0N/A * @exception InvalidParameterSpecException if the given parameter
0N/A * specification is inappropriate for the initialization of this parameter
0N/A * object.
0N/A */
0N/A protected abstract void engineInit(AlgorithmParameterSpec paramSpec)
0N/A throws InvalidParameterSpecException;
0N/A
0N/A /**
0N/A * Imports the specified parameters and decodes them
0N/A * according to the primary decoding format for parameters.
0N/A * The primary decoding format for parameters is ASN.1, if an ASN.1
0N/A * specification for this type of parameters exists.
0N/A *
0N/A * @param params the encoded parameters.
0N/A *
0N/A * @exception IOException on decoding errors
0N/A */
0N/A protected abstract void engineInit(byte[] params)
0N/A throws IOException;
0N/A
0N/A /**
0N/A * Imports the parameters from <code>params</code> and
0N/A * decodes them according to the specified decoding format.
0N/A * If <code>format</code> is null, the
0N/A * primary decoding format for parameters is used. The primary decoding
0N/A * format is ASN.1, if an ASN.1 specification for these parameters
0N/A * exists.
0N/A *
0N/A * @param params the encoded parameters.
0N/A *
0N/A * @param format the name of the decoding format.
0N/A *
0N/A * @exception IOException on decoding errors
0N/A */
0N/A protected abstract void engineInit(byte[] params, String format)
0N/A throws IOException;
0N/A
0N/A /**
0N/A * Returns a (transparent) specification of this parameters
0N/A * object.
0N/A * <code>paramSpec</code> identifies the specification class in which
0N/A * the parameters should be returned. It could, for example, be
0N/A * <code>DSAParameterSpec.class</code>, to indicate that the
0N/A * parameters should be returned in an instance of the
0N/A * <code>DSAParameterSpec</code> class.
0N/A *
1104N/A * @param paramSpec the specification class in which
0N/A * the parameters should be returned.
0N/A *
0N/A * @return the parameter specification.
0N/A *
0N/A * @exception InvalidParameterSpecException if the requested parameter
0N/A * specification is inappropriate for this parameter object.
0N/A */
0N/A protected abstract
0N/A <T extends AlgorithmParameterSpec>
0N/A T engineGetParameterSpec(Class<T> paramSpec)
0N/A throws InvalidParameterSpecException;
0N/A
0N/A /**
0N/A * Returns the parameters in their primary encoding format.
0N/A * The primary encoding format for parameters is ASN.1, if an ASN.1
0N/A * specification for this type of parameters exists.
0N/A *
0N/A * @return the parameters encoded using their primary encoding format.
0N/A *
0N/A * @exception IOException on encoding errors.
0N/A */
0N/A protected abstract byte[] engineGetEncoded() throws IOException;
0N/A
0N/A /**
0N/A * Returns the parameters encoded in the specified format.
0N/A * If <code>format</code> is null, the
0N/A * primary encoding format for parameters is used. The primary encoding
0N/A * format is ASN.1, if an ASN.1 specification for these parameters
0N/A * exists.
0N/A *
0N/A * @param format the name of the encoding format.
0N/A *
0N/A * @return the parameters encoded using the specified encoding scheme.
0N/A *
0N/A * @exception IOException on encoding errors.
0N/A */
0N/A protected abstract byte[] engineGetEncoded(String format)
0N/A throws IOException;
0N/A
0N/A /**
0N/A * Returns a formatted string describing the parameters.
0N/A *
0N/A * @return a formatted string describing the parameters.
0N/A */
0N/A protected abstract String engineToString();
0N/A}