01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /**
19: * @author Alexander Y. Kleymenov
20: * @version $Revision$
21: */package javax.crypto.spec;
22:
23: import java.security.spec.MGF1ParameterSpec;
24: import java.security.spec.AlgorithmParameterSpec;
25: import javax.crypto.spec.PSource;
26:
27: /**
28: * @com.intel.drl.spec_ref
29: */
30: public class OAEPParameterSpec implements AlgorithmParameterSpec {
31:
32: private final String mdName;
33: private final String mgfName;
34: private final AlgorithmParameterSpec mgfSpec;
35: private final PSource pSrc;
36:
37: /**
38: * @com.intel.drl.spec_ref
39: */
40: public static final OAEPParameterSpec DEFAULT = new OAEPParameterSpec();
41:
42: private OAEPParameterSpec() {
43: this .mdName = "SHA-1"; //$NON-NLS-1$
44: this .mgfName = "MGF1"; //$NON-NLS-1$
45: this .mgfSpec = MGF1ParameterSpec.SHA1;
46: this .pSrc = PSource.PSpecified.DEFAULT;
47: }
48:
49: /**
50: * @com.intel.drl.spec_ref
51: */
52: public OAEPParameterSpec(String mdName, String mgfName,
53: AlgorithmParameterSpec mgfSpec, PSource pSrc) {
54: if ((mdName == null) || (mgfName == null) || (pSrc == null)) {
55: throw new NullPointerException();
56: }
57: this .mdName = mdName;
58: this .mgfName = mgfName;
59: this .mgfSpec = mgfSpec;
60: this .pSrc = pSrc;
61: }
62:
63: /**
64: * @com.intel.drl.spec_ref
65: */
66: public String getDigestAlgorithm() {
67: return mdName;
68: }
69:
70: /**
71: * @com.intel.drl.spec_ref
72: */
73: public String getMGFAlgorithm() {
74: return mgfName;
75: }
76:
77: /**
78: * @com.intel.drl.spec_ref
79: */
80: public AlgorithmParameterSpec getMGFParameters() {
81: return mgfSpec;
82: }
83:
84: /**
85: * @com.intel.drl.spec_ref
86: */
87: public PSource getPSource() {
88: return pSrc;
89: }
90: }
|