Welcome to mirror list, hosted at ThFree Co, Russian Federation.

IESUtil.java « util « asymmetric « provider « jcajce « bouncycastle « org « java « main « src « prov - gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 93ed727d05b8950b052797e821b22b88dcdad0d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package org.bouncycastle.jcajce.provider.asymmetric.util;

import org.bouncycastle.crypto.engines.IESEngine;
import org.bouncycastle.jce.spec.IESParameterSpec;

public class IESUtil
{
    public static IESParameterSpec guessParameterSpec(IESEngine engine)
    {
        if (engine.getCipher() == null)
        {
            return new IESParameterSpec(null, null, 128);
        }
        else if (engine.getCipher().getUnderlyingCipher().getAlgorithmName().equals("DES") ||
                engine.getCipher().getUnderlyingCipher().getAlgorithmName().equals("RC2") ||
                engine.getCipher().getUnderlyingCipher().getAlgorithmName().equals("RC5-32") ||
                engine.getCipher().getUnderlyingCipher().getAlgorithmName().equals("RC5-64"))
        {
            return new IESParameterSpec(null, null, 64, 64);
        }
        else if (engine.getCipher().getUnderlyingCipher().getAlgorithmName().equals("SKIPJACK"))
        {
            return new IESParameterSpec(null, null, 80, 80);
        }
        else if (engine.getCipher().getUnderlyingCipher().getAlgorithmName().equals("GOST28147"))
        {
            return new IESParameterSpec(null, null, 256, 256);
        }

        return new IESParameterSpec(null, null, 128, 128);
    }
}