jdk/src/share/classes/com/sun/crypto/provider/DESedeParameters.java
changeset 10336 0bb1999251f8
parent 5506 202f599c92aa
equal deleted inserted replaced
10335:3c7eda3ab2f5 10336:0bb1999251f8
     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 Triple DES algorithm
    34  * This class implements the parameter (IV) used with the Triple DES algorithm
    38  * in feedback-mode. IV is defined in the standards as follows:
    35  * in feedback-mode. IV is defined in the standards as follows:
    39  *
    36  *
    65     protected void engineInit(byte[] encoded, String decodingMethod)
    62     protected void engineInit(byte[] encoded, String decodingMethod)
    66         throws IOException {
    63         throws IOException {
    67         core.init(encoded, decodingMethod);
    64         core.init(encoded, decodingMethod);
    68     }
    65     }
    69 
    66 
    70     protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
    67     protected <T extends AlgorithmParameterSpec>
       
    68         T engineGetParameterSpec(Class<T> paramSpec)
    71         throws InvalidParameterSpecException {
    69         throws InvalidParameterSpecException {
    72         return core.getParameterSpec(paramSpec);
    70         if (AlgorithmParameterSpec.class.isAssignableFrom(paramSpec)) {
       
    71             return core.getParameterSpec(paramSpec);
       
    72         } else {
       
    73             throw new InvalidParameterSpecException
       
    74                 ("Inappropriate parameter Specification");
       
    75         }
    73     }
    76     }
    74 
    77 
    75     protected byte[] engineGetEncoded() throws IOException {
    78     protected byte[] engineGetEncoded() throws IOException {
    76         return core.getEncoded();
    79         return core.getEncoded();
    77     }
    80     }