equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package com.sun.crypto.provider; |
26 package com.sun.crypto.provider; |
27 |
27 |
28 import java.util.*; |
|
29 import java.io.*; |
28 import java.io.*; |
30 import sun.security.util.*; |
|
31 import java.security.AlgorithmParametersSpi; |
29 import java.security.AlgorithmParametersSpi; |
32 import java.security.spec.AlgorithmParameterSpec; |
30 import java.security.spec.AlgorithmParameterSpec; |
33 import java.security.spec.InvalidParameterSpecException; |
31 import java.security.spec.InvalidParameterSpecException; |
34 import javax.crypto.spec.IvParameterSpec; |
|
35 |
32 |
36 /** |
33 /** |
37 * This class implements the parameter (IV) used with the DES algorithm in |
34 * This class implements the parameter (IV) used with the DES algorithm in |
38 * feedback-mode. IV is defined in the standards as follows: |
35 * feedback-mode. IV is defined in the standards as follows: |
39 * |
36 * |
66 protected void engineInit(byte[] encoded, String decodingMethod) |
63 protected void engineInit(byte[] encoded, String decodingMethod) |
67 throws IOException { |
64 throws IOException { |
68 core.init(encoded, decodingMethod); |
65 core.init(encoded, decodingMethod); |
69 } |
66 } |
70 |
67 |
71 protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec) |
68 protected <T extends AlgorithmParameterSpec> |
|
69 T engineGetParameterSpec(Class<T> paramSpec) |
72 throws InvalidParameterSpecException { |
70 throws InvalidParameterSpecException { |
73 return core.getParameterSpec(paramSpec); |
71 if (AlgorithmParameterSpec.class.isAssignableFrom(paramSpec)) { |
|
72 return core.getParameterSpec(paramSpec); |
|
73 } else { |
|
74 throw new InvalidParameterSpecException |
|
75 ("Inappropriate parameter Specification"); |
|
76 } |
74 } |
77 } |
75 |
78 |
76 protected byte[] engineGetEncoded() throws IOException { |
79 protected byte[] engineGetEncoded() throws IOException { |
77 return core.getEncoded(); |
80 return core.getEncoded(); |
78 } |
81 } |