/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.crypto.spec; import java.security.spec.AlgorithmParameterSpec; import java.security.spec.MGF1ParameterSpec; /** * The algorithm parameter specification for the OAEP Padding algorithm. *
* This padding algorithm is defined in the PKCS #1 standard. */ public class OAEPParameterSpec implements AlgorithmParameterSpec { private final String mdName; private final String mgfName; private final AlgorithmParameterSpec mgfSpec; private final PSource pSrc; /** * The algorithm parameter instance with default values. *
* It uses the following parameters: *
"SHA-1"
"MGF1"
L
: {@link PSource.PSpecified#DEFAULT}OAEPParameterSpec
instance with the specified
* message digest algorithm name, mask generation function
* (mgf) algorithm name, parameters for the mgf
* algorithm and the source of the label L
.
*
* @param mdName
* the message digest algorithm name.
* @param mgfName
* the mask generation function algorithm name.
* @param mgfSpec
* the algorithm parameter specification for the mask generation
* function algorithm.
* @param pSrc
* the source of the label L
.
* @throws NullPointerException
* if one of mdName
, mgfName
or
* pSrc
is null.
*/
public OAEPParameterSpec(String mdName, String mgfName,
AlgorithmParameterSpec mgfSpec, PSource pSrc) {
if ((mdName == null) || (mgfName == null) || (pSrc == null)) {
throw new NullPointerException();
}
this.mdName = mdName;
this.mgfName = mgfName;
this.mgfSpec = mgfSpec;
this.pSrc = pSrc;
}
/**
* Returns the algorithm name of the message digest.
*
* @return the algorithm name of the message digest.
*/
public String getDigestAlgorithm() {
return mdName;
}
/**
* Returns the algorithm name of the mask generation function.
*
* @return the algorithm name of the mask generation function.
*/
public String getMGFAlgorithm() {
return mgfName;
}
/**
* Returns the algorithm parameter specification for the mask generation
* function algorithm.
*
* @return the algorithm parameter specification for the mask generation
* function algorithm.
*/
public AlgorithmParameterSpec getMGFParameters() {
return mgfSpec;
}
/**
* Returns the source of the label L
.
*
* @return the source of the label L
.
*/
public PSource getPSource() {
return pSrc;
}
}