author | valeriep |
Tue, 08 May 2012 17:57:48 -0700 | |
changeset 12685 | 8a448b5b9006 |
parent 10336 | 0bb1999251f8 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
2 |
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package com.sun.crypto.provider; |
|
27 |
||
28 |
import java.io.*; |
|
29 |
import java.security.AlgorithmParametersSpi; |
|
30 |
import java.security.spec.AlgorithmParameterSpec; |
|
31 |
import java.security.spec.InvalidParameterSpecException; |
|
32 |
||
33 |
/** |
|
34 |
* This class implements the parameter (IV) used with the Blowfish algorithm in |
|
35 |
* feedback-mode. IV is defined in the standards as follows: |
|
36 |
* |
|
37 |
* <pre> |
|
38 |
* IV ::= OCTET STRING -- 8 octets |
|
39 |
* </pre> |
|
40 |
* |
|
41 |
* @author Jan Luehe |
|
42 |
* |
|
43 |
*/ |
|
44 |
||
45 |
public final class BlowfishParameters extends AlgorithmParametersSpi { |
|
46 |
||
47 |
private BlockCipherParamsCore core; |
|
48 |
||
49 |
public BlowfishParameters() { |
|
50 |
core = new BlockCipherParamsCore |
|
51 |
(BlowfishConstants.BLOWFISH_BLOCK_SIZE); |
|
52 |
} |
|
53 |
protected void engineInit(AlgorithmParameterSpec paramSpec) |
|
54 |
throws InvalidParameterSpecException { |
|
55 |
core.init(paramSpec); |
|
56 |
} |
|
57 |
||
58 |
protected void engineInit(byte[] encoded) |
|
59 |
throws IOException { |
|
60 |
core.init(encoded); |
|
61 |
} |
|
62 |
||
63 |
protected void engineInit(byte[] encoded, String decodingMethod) |
|
64 |
throws IOException { |
|
65 |
core.init(encoded, decodingMethod); |
|
66 |
} |
|
67 |
||
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
68 |
protected <T extends AlgorithmParameterSpec> |
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
69 |
T engineGetParameterSpec(Class<T> paramSpec) |
2 | 70 |
throws InvalidParameterSpecException { |
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
71 |
if (AlgorithmParameterSpec.class.isAssignableFrom(paramSpec)) { |
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
72 |
return core.getParameterSpec(paramSpec); |
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
73 |
} else { |
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
74 |
throw new InvalidParameterSpecException |
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
75 |
("Inappropriate parameter Specification"); |
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
76 |
} |
2 | 77 |
} |
78 |
||
79 |
protected byte[] engineGetEncoded() throws IOException { |
|
80 |
return core.getEncoded(); |
|
81 |
} |
|
82 |
||
83 |
protected byte[] engineGetEncoded(String encodingMethod) |
|
84 |
throws IOException { |
|
85 |
return core.getEncoded(); |
|
86 |
} |
|
87 |
||
88 |
protected String engineToString() { |
|
89 |
return core.toString(); |
|
90 |
} |
|
91 |
} |