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 org.apache.harmony.crypto.internal.nls.Messages;
24:
25: /**
26: * @com.intel.drl.spec_ref
27: */
28: public class PSource {
29:
30: private String pSrcName;
31:
32: private PSource() {
33: }
34:
35: /**
36: * @com.intel.drl.spec_ref
37: */
38: protected PSource(String pSrcName) {
39: if (pSrcName == null) {
40: throw new NullPointerException(Messages
41: .getString("crypto.42")); //$NON-NLS-1$
42: }
43: this .pSrcName = pSrcName;
44: }
45:
46: /**
47: * @com.intel.drl.spec_ref
48: */
49: public String getAlgorithm() {
50: return pSrcName;
51: }
52:
53: /**
54: * @com.intel.drl.spec_ref
55: */
56: public static final class PSpecified extends PSource {
57:
58: private final byte[] p;
59:
60: /**
61: * @com.intel.drl.spec_ref
62: */
63: public static final PSpecified DEFAULT = new PSpecified();
64:
65: private PSpecified() {
66: super ("PSpecified"); //$NON-NLS-1$
67: p = new byte[0];
68: }
69:
70: /**
71: * @com.intel.drl.spec_ref
72: */
73: public PSpecified(byte[] p) {
74: super ("PSpecified"); //$NON-NLS-1$
75: if (p == null) {
76: throw new NullPointerException(Messages
77: .getString("crypto.43")); //$NON-NLS-1$
78: }
79: //TODO: It is unknown which name should be used!
80: //super("");
81: this .p = new byte[p.length];
82: System.arraycopy(p, 0, this .p, 0, p.length);
83: }
84:
85: /**
86: * @com.intel.drl.spec_ref
87: */
88: public byte[] getValue() {
89: byte[] result = new byte[p.length];
90: System.arraycopy(p, 0, result, 0, p.length);
91: return result;
92: }
93: }
94: }
|