1a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrompackage org.bouncycastle.jcajce.provider.symmetric;
2a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
3a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport java.io.IOException;
4a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport java.security.AlgorithmParameters;
5a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport java.security.InvalidAlgorithmParameterException;
6a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport java.security.SecureRandom;
7a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport java.security.spec.AlgorithmParameterSpec;
8a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport java.security.spec.InvalidParameterSpecException;
9a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
10a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport javax.crypto.spec.IvParameterSpec;
11a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport javax.crypto.spec.RC2ParameterSpec;
12a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
13a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport org.bouncycastle.asn1.ASN1Primitive;
14a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
15a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// BEGIN android-removed
16a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// import org.bouncycastle.asn1.pkcs.RC2CBCParameter;
17a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// import org.bouncycastle.crypto.CipherKeyGenerator;
18a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// END android-removed
19a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport org.bouncycastle.crypto.engines.RC2Engine;
20a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// BEGIN android-removed
21a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// import org.bouncycastle.crypto.engines.RC2WrapEngine;
22a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// import org.bouncycastle.crypto.macs.CBCBlockCipherMac;
23a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// import org.bouncycastle.crypto.macs.CFBBlockCipherMac;
24a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// END android-removed
25a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport org.bouncycastle.crypto.modes.CBCBlockCipher;
26a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport org.bouncycastle.jcajce.provider.config.ConfigurableProvider;
27a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// BEGIN android-removed
28a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// import org.bouncycastle.jcajce.provider.symmetric.util.BaseAlgorithmParameterGenerator;
29a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// import org.bouncycastle.jcajce.provider.symmetric.util.BaseAlgorithmParameters;
30a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// END android-removed
31a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher;
32a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// BEGIN android-removed
33a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// import org.bouncycastle.jcajce.provider.symmetric.util.BaseKeyGenerator;
34a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// import org.bouncycastle.jcajce.provider.symmetric.util.BaseMac;
35a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// import org.bouncycastle.jcajce.provider.symmetric.util.BaseWrapCipher;
36a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// END android-removed
37a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport org.bouncycastle.jcajce.provider.symmetric.util.PBESecretKeyFactory;
38a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport org.bouncycastle.jcajce.provider.util.AlgorithmProvider;
39a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport org.bouncycastle.jce.provider.BouncyCastleProvider;
40a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// BEGIN android-removed
41a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// import org.bouncycastle.util.Arrays;
42a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// END android-removed
43a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
44a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrompublic final class RC2
45a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom{
46a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    private RC2()
47a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    {
48a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    }
49a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
50a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // BEGIN android-removed
51a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // /**
52a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //  * RC2
53a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //  */
54a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // static public class ECB
55a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     extends BaseBlockCipher
56a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // {
57a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     public ECB()
58a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     {
59a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         super(new RC2Engine());
60a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     }
61a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // }
62a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
63a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // /**
64a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //  * RC2CBC
65a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //  */
66a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // static public class CBC
67a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     extends BaseBlockCipher
68a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // {
69a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     public CBC()
70a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     {
71a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         super(new CBCBlockCipher(new RC2Engine()), 64);
72a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     }
73a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // }
74a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
75a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // public static class Wrap
76a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     extends BaseWrapCipher
77a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // {
78a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     public Wrap()
79a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     {
80a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         super(new RC2WrapEngine());
81a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     }
82a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // }
83a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
84a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // /**
85a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //  * RC2
86a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //  */
87a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // public static class CBCMAC
88a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     extends BaseMac
89a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // {
90a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     public CBCMAC()
91a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     {
92a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         super(new CBCBlockCipherMac(new RC2Engine()));
93a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     }
94a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // }
95a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
96a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // public static class CFB8MAC
97a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     extends BaseMac
98a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // {
99a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     public CFB8MAC()
100a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     {
101a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         super(new CFBBlockCipherMac(new RC2Engine()));
102a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     }
103a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // }
104a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // END android-removed
105a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
106a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    /**
107a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom     * PBEWithSHA1AndRC2
108a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom     */
109a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    static public class PBEWithSHA1KeyFactory
110a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        extends PBESecretKeyFactory
111a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    {
112a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        public PBEWithSHA1KeyFactory()
113a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        {
114a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            super("PBEwithSHA1andRC2", PKCSObjectIdentifiers.pbeWithSHA1AndRC2_CBC, true, PKCS5S1, SHA1, 64, 64);
115a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        }
116a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    }
117a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
118a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    /**
119a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom     * PBEWithSHAAnd128BitRC2-CBC
120a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom     */
121a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    static public class PBEWithSHAAnd128BitKeyFactory
122a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        extends PBESecretKeyFactory
123a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    {
124a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        public PBEWithSHAAnd128BitKeyFactory()
125a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        {
126a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            super("PBEwithSHAand128BitRC2-CBC", PKCSObjectIdentifiers.pbeWithSHAAnd128BitRC2_CBC, true, PKCS12, SHA1, 128, 64);
127a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        }
128a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    }
129a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
130a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    /**
131a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom     * PBEWithSHAAnd40BitRC2-CBC
132a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom     */
133a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    static public class PBEWithSHAAnd40BitKeyFactory
134a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        extends PBESecretKeyFactory
135a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    {
136a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        public PBEWithSHAAnd40BitKeyFactory()
137a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        {
138a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            super("PBEwithSHAand40BitRC2-CBC", PKCSObjectIdentifiers.pbeWithSHAAnd40BitRC2_CBC, true, PKCS12, SHA1, 40, 64);
139a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        }
140a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    }
141a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
142a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    /**
143a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom     * PBEWithMD5AndRC2
144a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom     */
145a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    static public class PBEWithMD5AndRC2
146a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        extends BaseBlockCipher
147a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    {
148a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        public PBEWithMD5AndRC2()
149a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        {
150a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            super(new CBCBlockCipher(new RC2Engine()));
151a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        }
152a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    }
153a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
154a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    /**
155a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom     * PBEWithSHA1AndRC2
156a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom     */
157a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    static public class PBEWithSHA1AndRC2
158a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        extends BaseBlockCipher
159a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    {
160a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        public PBEWithSHA1AndRC2()
161a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        {
162a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            super(new CBCBlockCipher(new RC2Engine()));
163a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        }
164a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    }
165a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
166a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    /**
167a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom     * PBEWithSHAAnd128BitRC2-CBC
168a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom     */
169a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    static public class PBEWithSHAAnd128BitRC2
170a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        extends BaseBlockCipher
171a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    {
172a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        public PBEWithSHAAnd128BitRC2()
173a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        {
174a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            super(new CBCBlockCipher(new RC2Engine()));
175a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        }
176a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    }
177a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
178a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    /**
179a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom     * PBEWithSHAAnd40BitRC2-CBC
180a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom     */
181a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    static public class PBEWithSHAAnd40BitRC2
182a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        extends BaseBlockCipher
183a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    {
184a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        public PBEWithSHAAnd40BitRC2()
185a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        {
186a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            super(new CBCBlockCipher(new RC2Engine()));
187a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        }
188a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    }
189a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
190a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // BEGIN android-removed
191a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // /**
192a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //  * PBEWithMD2AndRC2
193a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //  */
194a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // static public class PBEWithMD2KeyFactory
195a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     extends PBESecretKeyFactory
196a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // {
197a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     public PBEWithMD2KeyFactory()
198a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     {
199a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         super("PBEwithMD2andRC2", PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, true, PKCS5S1, MD2, 64, 64);
200a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     }
201a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // }
202a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // END android-removed
203a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
204a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom   /**
205a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    * PBEWithMD5AndRC2
206a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    */
207a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom   static public class PBEWithMD5KeyFactory
208a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom       extends PBESecretKeyFactory
209a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom   {
210a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom       public PBEWithMD5KeyFactory()
211a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom       {
212a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom           super("PBEwithMD5andRC2", PKCSObjectIdentifiers.pbeWithMD5AndRC2_CBC, true, PKCS5S1, MD5, 64, 64);
213a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom       }
214a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom   }
215a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
216a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // BEGIN android-removed
217a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // public static class AlgParamGen
218a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     extends BaseAlgorithmParameterGenerator
219a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // {
220a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     RC2ParameterSpec spec = null;
221a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
222a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     protected void engineInit(
223a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         AlgorithmParameterSpec genParamSpec,
224a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         SecureRandom random)
225a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         throws InvalidAlgorithmParameterException
226a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     {
227a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         if (genParamSpec instanceof RC2ParameterSpec)
228a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         {
229a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             spec = (RC2ParameterSpec)genParamSpec;
230a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             return;
231a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         }
232a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
233a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for RC2 parameter generation.");
234a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     }
235a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
236a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     protected AlgorithmParameters engineGenerateParameters()
237a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     {
238a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         AlgorithmParameters params;
239a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
240a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         if (spec == null)
241a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         {
242a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             byte[] iv = new byte[8];
243a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
244a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             if (random == null)
245a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             {
246a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 random = new SecureRandom();
247a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             }
248a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
249a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             random.nextBytes(iv);
250a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
251a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             try
252a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             {
253a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 params = AlgorithmParameters.getInstance("RC2", BouncyCastleProvider.PROVIDER_NAME);
254a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 params.init(new IvParameterSpec(iv));
255a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             }
256a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             catch (Exception e)
257a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             {
258a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 throw new RuntimeException(e.getMessage());
259a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             }
260a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         }
261a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         else
262a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         {
263a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             try
264a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             {
265a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 params = AlgorithmParameters.getInstance("RC2", BouncyCastleProvider.PROVIDER_NAME);
266a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 params.init(spec);
267a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             }
268a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             catch (Exception e)
269a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             {
270a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 throw new RuntimeException(e.getMessage());
271a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             }
272a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         }
273a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
274a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         return params;
275a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     }
276a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // }
277a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
278a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // public static class KeyGenerator
279a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     extends BaseKeyGenerator
280a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // {
281a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     public KeyGenerator()
282a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     {
283a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         super("RC2", 128, new CipherKeyGenerator());
284a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     }
285a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // }
286a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
287a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // public static class AlgParams
288a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     extends BaseAlgorithmParameters
289a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // {
290a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     private static final short[] table = {
291a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a, 0xb0, 0x93, 0xd1, 0x9c, 0x1b, 0x33, 0xfd, 0xd0,
292a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b, 0xf7, 0xcb, 0x45, 0x9b, 0x31, 0xbb, 0x21, 0x5a,
293a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x41, 0x9f, 0xe1, 0xd9, 0x4a, 0x4d, 0x9e, 0xda, 0xa0, 0x68, 0x2c, 0xc3, 0x27, 0x5f, 0x80, 0x36,
294a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x3e, 0xee, 0xfb, 0x95, 0x1a, 0xfe, 0xce, 0xa8, 0x34, 0xa9, 0x13, 0xf0, 0xa6, 0x3f, 0xd8, 0x0c,
295a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x78, 0x24, 0xaf, 0x23, 0x52, 0xc1, 0x67, 0x17, 0xf5, 0x66, 0x90, 0xe7, 0xe8, 0x07, 0xb8, 0x60,
296a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x48, 0xe6, 0x1e, 0x53, 0xf3, 0x92, 0xa4, 0x72, 0x8c, 0x08, 0x15, 0x6e, 0x86, 0x00, 0x84, 0xfa,
297a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0xf4, 0x7f, 0x8a, 0x42, 0x19, 0xf6, 0xdb, 0xcd, 0x14, 0x8d, 0x50, 0x12, 0xba, 0x3c, 0x06, 0x4e,
298a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0xec, 0xb3, 0x35, 0x11, 0xa1, 0x88, 0x8e, 0x2b, 0x94, 0x99, 0xb7, 0x71, 0x74, 0xd3, 0xe4, 0xbf,
299a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x3a, 0xde, 0x96, 0x0e, 0xbc, 0x0a, 0xed, 0x77, 0xfc, 0x37, 0x6b, 0x03, 0x79, 0x89, 0x62, 0xc6,
300a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0xd7, 0xc0, 0xd2, 0x7c, 0x6a, 0x8b, 0x22, 0xa3, 0x5b, 0x05, 0x5d, 0x02, 0x75, 0xd5, 0x61, 0xe3,
301a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x18, 0x8f, 0x55, 0x51, 0xad, 0x1f, 0x0b, 0x5e, 0x85, 0xe5, 0xc2, 0x57, 0x63, 0xca, 0x3d, 0x6c,
302a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0xb4, 0xc5, 0xcc, 0x70, 0xb2, 0x91, 0x59, 0x0d, 0x47, 0x20, 0xc8, 0x4f, 0x58, 0xe0, 0x01, 0xe2,
303a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x16, 0x38, 0xc4, 0x6f, 0x3b, 0x0f, 0x65, 0x46, 0xbe, 0x7e, 0x2d, 0x7b, 0x82, 0xf9, 0x40, 0xb5,
304a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x1d, 0x73, 0xf8, 0xeb, 0x26, 0xc7, 0x87, 0x97, 0x25, 0x54, 0xb1, 0x28, 0xaa, 0x98, 0x9d, 0xa5,
305a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x64, 0x6d, 0x7a, 0xd4, 0x10, 0x81, 0x44, 0xef, 0x49, 0xd6, 0xae, 0x2e, 0xdd, 0x76, 0x5c, 0x2f,
306a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0xa7, 0x1c, 0xc9, 0x09, 0x69, 0x9a, 0x83, 0xcf, 0x29, 0x39, 0xb9, 0xe9, 0x4c, 0xff, 0x43, 0xab
307a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     };
308a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
309a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     private static final short[] ekb = {
310a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x5d, 0xbe, 0x9b, 0x8b, 0x11, 0x99, 0x6e, 0x4d, 0x59, 0xf3, 0x85, 0xa6, 0x3f, 0xb7, 0x83, 0xc5,
311a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0xe4, 0x73, 0x6b, 0x3a, 0x68, 0x5a, 0xc0, 0x47, 0xa0, 0x64, 0x34, 0x0c, 0xf1, 0xd0, 0x52, 0xa5,
312a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0xb9, 0x1e, 0x96, 0x43, 0x41, 0xd8, 0xd4, 0x2c, 0xdb, 0xf8, 0x07, 0x77, 0x2a, 0xca, 0xeb, 0xef,
313a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x10, 0x1c, 0x16, 0x0d, 0x38, 0x72, 0x2f, 0x89, 0xc1, 0xf9, 0x80, 0xc4, 0x6d, 0xae, 0x30, 0x3d,
314a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0xce, 0x20, 0x63, 0xfe, 0xe6, 0x1a, 0xc7, 0xb8, 0x50, 0xe8, 0x24, 0x17, 0xfc, 0x25, 0x6f, 0xbb,
315a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x6a, 0xa3, 0x44, 0x53, 0xd9, 0xa2, 0x01, 0xab, 0xbc, 0xb6, 0x1f, 0x98, 0xee, 0x9a, 0xa7, 0x2d,
316a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x4f, 0x9e, 0x8e, 0xac, 0xe0, 0xc6, 0x49, 0x46, 0x29, 0xf4, 0x94, 0x8a, 0xaf, 0xe1, 0x5b, 0xc3,
317a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0xb3, 0x7b, 0x57, 0xd1, 0x7c, 0x9c, 0xed, 0x87, 0x40, 0x8c, 0xe2, 0xcb, 0x93, 0x14, 0xc9, 0x61,
318a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x2e, 0xe5, 0xcc, 0xf6, 0x5e, 0xa8, 0x5c, 0xd6, 0x75, 0x8d, 0x62, 0x95, 0x58, 0x69, 0x76, 0xa1,
319a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x4a, 0xb5, 0x55, 0x09, 0x78, 0x33, 0x82, 0xd7, 0xdd, 0x79, 0xf5, 0x1b, 0x0b, 0xde, 0x26, 0x21,
320a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x28, 0x74, 0x04, 0x97, 0x56, 0xdf, 0x3c, 0xf0, 0x37, 0x39, 0xdc, 0xff, 0x06, 0xa4, 0xea, 0x42,
321a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x08, 0xda, 0xb4, 0x71, 0xb0, 0xcf, 0x12, 0x7a, 0x4e, 0xfa, 0x6c, 0x1d, 0x84, 0x00, 0xc8, 0x7f,
322a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x91, 0x45, 0xaa, 0x2b, 0xc2, 0xb1, 0x8f, 0xd5, 0xba, 0xf2, 0xad, 0x19, 0xb2, 0x67, 0x36, 0xf7,
323a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x0f, 0x0a, 0x92, 0x7d, 0xe3, 0x9d, 0xe9, 0x90, 0x3e, 0x23, 0x27, 0x66, 0x13, 0xec, 0x81, 0x15,
324a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0xbd, 0x22, 0xbf, 0x9f, 0x7e, 0xa9, 0x51, 0x4b, 0x4c, 0xfb, 0x02, 0xd3, 0x70, 0x86, 0x31, 0xe7,
325a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         0x3b, 0x05, 0x03, 0x54, 0x60, 0x48, 0x65, 0x18, 0xd2, 0xcd, 0x5f, 0x32, 0x88, 0x0e, 0x35, 0xfd
326a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     };
327a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
328a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     private byte[] iv;
329a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     private int parameterVersion = 58;
330a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
331a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     protected byte[] engineGetEncoded()
332a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     {
333a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         return Arrays.clone(iv);
334a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     }
335a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
336a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     protected byte[] engineGetEncoded(
337a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         String format)
338a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         throws IOException
339a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     {
340a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         if (this.isASN1FormatString(format))
341a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         {
342a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             if (parameterVersion == -1)
343a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             {
344a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 return new RC2CBCParameter(engineGetEncoded()).getEncoded();
345a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             }
346a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             else
347a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             {
348a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 return new RC2CBCParameter(parameterVersion, engineGetEncoded()).getEncoded();
349a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             }
350a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         }
351a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
352a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         if (format.equals("RAW"))
353a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         {
354a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             return engineGetEncoded();
355a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         }
356a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
357a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         return null;
358a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     }
359a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
360a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     protected AlgorithmParameterSpec localEngineGetParameterSpec(
361a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         Class paramSpec)
362a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         throws InvalidParameterSpecException
363a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     {
364a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         if (paramSpec == RC2ParameterSpec.class)
365a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         {
366a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             if (parameterVersion != -1)
367a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             {
368a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 if (parameterVersion < 256)
369a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 {
370a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                     return new RC2ParameterSpec(ekb[parameterVersion], iv);
371a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 }
372a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 else
373a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 {
374a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                     return new RC2ParameterSpec(parameterVersion, iv);
375a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 }
376a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             }
377a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         }
378a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
379a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         if (paramSpec == IvParameterSpec.class)
380a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         {
381a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             return new IvParameterSpec(iv);
382a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         }
383a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
384a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         throw new InvalidParameterSpecException("unknown parameter spec passed to RC2 parameters object.");
385a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     }
386a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
387a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     protected void engineInit(
388a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         AlgorithmParameterSpec paramSpec)
389a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         throws InvalidParameterSpecException
390a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     {
391a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         if (paramSpec instanceof IvParameterSpec)
392a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         {
393a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             this.iv = ((IvParameterSpec)paramSpec).getIV();
394a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         }
395a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         else if (paramSpec instanceof RC2ParameterSpec)
396a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         {
397a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             int effKeyBits = ((RC2ParameterSpec)paramSpec).getEffectiveKeyBits();
398a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             if (effKeyBits != -1)
399a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             {
400a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 if (effKeyBits < 256)
401a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 {
402a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                     parameterVersion = table[effKeyBits];
403a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 }
404a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 else
405a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 {
406a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                     parameterVersion = effKeyBits;
407a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 }
408a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             }
409a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
410a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             this.iv = ((RC2ParameterSpec)paramSpec).getIV();
411a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         }
412a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         else
413a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         {
414a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             throw new InvalidParameterSpecException("IvParameterSpec or RC2ParameterSpec required to initialise a RC2 parameters algorithm parameters object");
415a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         }
416a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     }
417a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
418a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     protected void engineInit(
419a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         byte[] params)
420a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         throws IOException
421a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     {
422a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         this.iv = Arrays.clone(params);
423a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     }
424a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
425a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     protected void engineInit(
426a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         byte[] params,
427a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         String format)
428a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         throws IOException
429a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     {
430a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         if (this.isASN1FormatString(format))
431a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         {
432a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             RC2CBCParameter p = RC2CBCParameter.getInstance(ASN1Primitive.fromByteArray(params));
433a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
434a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             if (p.getRC2ParameterVersion() != null)
435a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             {
436a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //                 parameterVersion = p.getRC2ParameterVersion().intValue();
437a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             }
438a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
439a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             iv = p.getIV();
440a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
441a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             return;
442a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         }
443a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
444a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         if (format.equals("RAW"))
445a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         {
446a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             engineInit(params);
447a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //             return;
448a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         }
449a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
450a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         throw new IOException("Unknown parameters format in IV parameters object");
451a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     }
452a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //
453a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     protected String engineToString()
454a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     {
455a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //         return "RC2 Parameters";
456a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    //     }
457a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // }
458a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    // END android-removed
459a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
460a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    public static class Mappings
461a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        extends AlgorithmProvider
462a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    {
463a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        private static final String PREFIX = RC2.class.getName();
464a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
465a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        public Mappings()
466a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        {
467a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        }
468a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
469a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        public void configure(ConfigurableProvider provider)
470a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        {
471a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
472a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // BEGIN android-removed
473a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // provider.addAlgorithm("AlgorithmParameterGenerator.RC2", PREFIX + "$AlgParamGen");
474a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // provider.addAlgorithm("AlgorithmParameterGenerator.1.2.840.113549.3.2", PREFIX + "$AlgParamGen");
475a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            //
476a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // provider.addAlgorithm("KeyGenerator.RC2", PREFIX + "$KeyGenerator");
477a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // provider.addAlgorithm("KeyGenerator.1.2.840.113549.3.2", PREFIX + "$KeyGenerator");
478a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            //
479a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // provider.addAlgorithm("AlgorithmParameters.RC2", PREFIX + "$AlgParams");
480a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // provider.addAlgorithm("AlgorithmParameters.1.2.840.113549.3.2", PREFIX + "$AlgParams");
481a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            //
482a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // provider.addAlgorithm("Cipher.RC2", PREFIX + "$ECB");
483a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // provider.addAlgorithm("Cipher.RC2WRAP", PREFIX + "$Wrap");
484a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // provider.addAlgorithm("Alg.Alias.Cipher." + PKCSObjectIdentifiers.id_alg_CMSRC2wrap, "RC2WRAP");
485a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // provider.addAlgorithm("Cipher.1.2.840.113549.3.2", PREFIX + "$CBC");
486a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            //
487a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // provider.addAlgorithm("Mac.RC2MAC", PREFIX + "$CBCMAC");
488a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // provider.addAlgorithm("Alg.Alias.Mac.RC2", "RC2MAC");
489a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // provider.addAlgorithm("Mac.RC2MAC/CFB8", PREFIX + "$CFB8MAC");
490a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // provider.addAlgorithm("Alg.Alias.Mac.RC2/CFB8", "RC2MAC/CFB8");
491a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            //
492a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHMD2ANDRC2-CBC", "PBEWITHMD2ANDRC2");
493a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // END android-removed
494a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
495a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHMD5ANDRC2-CBC", "PBEWITHMD5ANDRC2");
496a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
497a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHSHA1ANDRC2-CBC", "PBEWITHSHA1ANDRC2");
498a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
499a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // BEGIN android-removed
500a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, "PBEWITHMD2ANDRC2");
501a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // END android-removed
502a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
503a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithMD5AndRC2_CBC, "PBEWITHMD5ANDRC2");
504a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
505a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.pbeWithSHA1AndRC2_CBC, "PBEWITHSHA1ANDRC2");
506a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.5", "PBEWITHSHAAND128BITRC2-CBC");
507a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.6", "PBEWITHSHAAND40BITRC2-CBC");
508a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
509a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // BEGIN android-removed
510a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // provider.addAlgorithm("SecretKeyFactory.PBEWITHMD2ANDRC2", PREFIX + "$PBEWithMD2KeyFactory");
511a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // END android-removed
512a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("SecretKeyFactory.PBEWITHMD5ANDRC2", PREFIX + "$PBEWithMD5KeyFactory");
513a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("SecretKeyFactory.PBEWITHSHA1ANDRC2", PREFIX + "$PBEWithSHA1KeyFactory");
514a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
515a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("SecretKeyFactory.PBEWITHSHAAND128BITRC2-CBC", PREFIX + "$PBEWithSHAAnd128BitKeyFactory");
516a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("SecretKeyFactory.PBEWITHSHAAND40BITRC2-CBC", PREFIX + "$PBEWithSHAAnd40BitKeyFactory");
517a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
518a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // BEGIN android-removed
519a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // provider.addAlgorithm("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithMD2AndRC2_CBC, "PBEWITHMD2ANDRC2");
520a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            // END android-removed
521a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
522a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithMD5AndRC2_CBC, "PBEWITHMD5ANDRC2");
523a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
524a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.Cipher." + PKCSObjectIdentifiers.pbeWithSHA1AndRC2_CBC, "PBEWITHSHA1ANDRC2");
525a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
526a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.5", "PKCS12PBE");
527a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.6", "PKCS12PBE");
528a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWithSHAAnd3KeyTripleDES", "PKCS12PBE");
529a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
530a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.Cipher.1.2.840.113549.1.12.1.5", "PBEWITHSHAAND128BITRC2-CBC");
531a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.Cipher.1.2.840.113549.1.12.1.6", "PBEWITHSHAAND40BITRC2-CBC");
532a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.Cipher.PBEWITHSHA1AND128BITRC2-CBC", "PBEWITHSHAAND128BITRC2-CBC");
533a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.Cipher.PBEWITHSHA1AND40BITRC2-CBC", "PBEWITHSHAAND40BITRC2-CBC");
534a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Cipher.PBEWITHSHA1ANDRC2", PREFIX + "$PBEWithSHA1AndRC2");
535a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
536a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Cipher.PBEWITHSHAAND128BITRC2-CBC", PREFIX + "$PBEWithSHAAnd128BitRC2");
537a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Cipher.PBEWITHSHAAND40BITRC2-CBC", PREFIX + "$PBEWithSHAAnd40BitRC2");
538a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Cipher.PBEWITHMD5ANDRC2", PREFIX + "$PBEWithMD5AndRC2");
539a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom
540a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHA1ANDRC2", "PKCS12PBE");
541a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDRC2", "PKCS12PBE");
542a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHA1ANDRC2-CBC", "PKCS12PBE");
543a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND40BITRC2-CBC", "PKCS12PBE");
544a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom            provider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND128BITRC2-CBC", "PKCS12PBE");
545a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom        }
546a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom    }
547a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom}
548