Java Code Examples for java.security.AlgorithmParameters#toString()

The following examples show how to use java.security.AlgorithmParameters#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BrokenJCEBlockCipher.java    From ripple-lib-java with ISC License 5 votes vote down vote up
protected void engineInit(
    int                 opmode,
    Key                 key,
    AlgorithmParameters params,
    SecureRandom        random) 
throws InvalidKeyException, InvalidAlgorithmParameterException
{
    AlgorithmParameterSpec  paramSpec = null;

    if (params != null)
    {
        for (int i = 0; i != availableSpecs.length; i++)
        {
            try
            {
                paramSpec = params.getParameterSpec(availableSpecs[i]);
                break;
            }
            catch (Exception e)
            {
                continue;
            }
        }

        if (paramSpec == null)
        {
            throw new InvalidAlgorithmParameterException("can't handle parameter " + params.toString());
        }
    }

    engineParams = params;
    engineInit(opmode, key, paramSpec, random);
}
 
Example 2
Source File: CipherSpi.java    From RipplePower with Apache License 2.0 5 votes vote down vote up
protected void engineInit(
    int                 opmode,
    Key                 key,
    AlgorithmParameters params,
    SecureRandom        random) 
throws InvalidKeyException, InvalidAlgorithmParameterException
{
    AlgorithmParameterSpec  paramSpec = null;

    if (params != null)
    {
        for (int i = 0; i != availableSpecs.length; i++)
        {
            try
            {
                paramSpec = params.getParameterSpec(availableSpecs[i]);
                break;
            }
            catch (Exception e)
            {
                continue;
            }
        }

        if (paramSpec == null)
        {
            throw new InvalidAlgorithmParameterException("can't handle parameter " + params.toString());
        }
    }

    engineParam = params;
    engineInit(opmode, key, paramSpec, random);
}
 
Example 3
Source File: BaseStreamCipher.java    From RipplePower with Apache License 2.0 5 votes vote down vote up
protected void engineInit(
    int                 opmode,
    Key                 key,
    AlgorithmParameters params,
    SecureRandom        random) 
    throws InvalidKeyException, InvalidAlgorithmParameterException
{
    AlgorithmParameterSpec  paramSpec = null;

    if (params != null)
    {
        for (int i = 0; i != availableSpecs.length; i++)
        {
            try
            {
                paramSpec = params.getParameterSpec(availableSpecs[i]);
                break;
            }
            catch (Exception e)
            {
                continue;
            }
        }

        if (paramSpec == null)
        {
            throw new InvalidAlgorithmParameterException("can't handle parameter " + params.toString());
        }
    }

    engineInit(opmode, key, paramSpec, random);
    engineParams = params;
}
 
Example 4
Source File: BaseWrapCipher.java    From RipplePower with Apache License 2.0 5 votes vote down vote up
protected void engineInit(
    int                 opmode,
    Key                 key,
    AlgorithmParameters params,
    SecureRandom        random)
throws InvalidKeyException, InvalidAlgorithmParameterException
{
    AlgorithmParameterSpec  paramSpec = null;

    if (params != null)
    {
        for (int i = 0; i != availableSpecs.length; i++)
        {
            try
            {
                paramSpec = params.getParameterSpec(availableSpecs[i]);
                break;
            }
            catch (Exception e)
            {
                // try next spec
            }
        }

        if (paramSpec == null)
        {
            throw new InvalidAlgorithmParameterException("can't handle parameter " + params.toString());
        }
    }

    engineParams = params;
    engineInit(opmode, key, paramSpec, random);
}
 
Example 5
Source File: BaseBlockCipher.java    From RipplePower with Apache License 2.0 5 votes vote down vote up
protected void engineInit(
    int                 opmode,
    Key                 key,
    AlgorithmParameters params,
    SecureRandom        random) 
throws InvalidKeyException, InvalidAlgorithmParameterException
{
    AlgorithmParameterSpec  paramSpec = null;

    if (params != null)
    {
        for (int i = 0; i != availableSpecs.length; i++)
        {
            if (availableSpecs[i] == null)
            {
                continue;
            }

            try
            {
                paramSpec = params.getParameterSpec(availableSpecs[i]);
                break;
            }
            catch (Exception e)
            {
                // try again if possible
            }
        }

        if (paramSpec == null)
        {
            throw new InvalidAlgorithmParameterException("can't handle parameter " + params.toString());
        }
    }

    engineInit(opmode, key, paramSpec, random);
    
    engineParams = params;
}
 
Example 6
Source File: BrokenJCEBlockCipher.java    From RipplePower with Apache License 2.0 5 votes vote down vote up
protected void engineInit(
    int                 opmode,
    Key                 key,
    AlgorithmParameters params,
    SecureRandom        random) 
throws InvalidKeyException, InvalidAlgorithmParameterException
{
    AlgorithmParameterSpec  paramSpec = null;

    if (params != null)
    {
        for (int i = 0; i != availableSpecs.length; i++)
        {
            try
            {
                paramSpec = params.getParameterSpec(availableSpecs[i]);
                break;
            }
            catch (Exception e)
            {
                continue;
            }
        }

        if (paramSpec == null)
        {
            throw new InvalidAlgorithmParameterException("can't handle parameter " + params.toString());
        }
    }

    engineParams = params;
    engineInit(opmode, key, paramSpec, random);
}
 
Example 7
Source File: PKCS12KeyStore.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return algorithm.toString();
}
 
Example 8
Source File: PKCS12KeyStore.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return algorithm.toString();
}
 
Example 9
Source File: BaseWrapCipher.java    From ripple-lib-java with ISC License 5 votes vote down vote up
protected void engineInit(
    int                 opmode,
    Key                 key,
    AlgorithmParameters params,
    SecureRandom        random)
throws InvalidKeyException, InvalidAlgorithmParameterException
{
    AlgorithmParameterSpec  paramSpec = null;

    if (params != null)
    {
        for (int i = 0; i != availableSpecs.length; i++)
        {
            try
            {
                paramSpec = params.getParameterSpec(availableSpecs[i]);
                break;
            }
            catch (Exception e)
            {
                // try next spec
            }
        }

        if (paramSpec == null)
        {
            throw new InvalidAlgorithmParameterException("can't handle parameter " + params.toString());
        }
    }

    engineParams = params;
    engineInit(opmode, key, paramSpec, random);
}
 
Example 10
Source File: PKCS12KeyStore.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return algorithm.toString();
}
 
Example 11
Source File: PKCS12KeyStore.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return algorithm.toString();
}
 
Example 12
Source File: PKCS12KeyStore.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return algorithm.toString();
}
 
Example 13
Source File: PKCS12KeyStore.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return algorithm.toString();
}
 
Example 14
Source File: PKCS12KeyStore.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return algorithm.toString();
}
 
Example 15
Source File: BaseBlockCipher.java    From ripple-lib-java with ISC License 5 votes vote down vote up
protected void engineInit(
    int                 opmode,
    Key                 key,
    AlgorithmParameters params,
    SecureRandom        random) 
throws InvalidKeyException, InvalidAlgorithmParameterException
{
    AlgorithmParameterSpec  paramSpec = null;

    if (params != null)
    {
        for (int i = 0; i != availableSpecs.length; i++)
        {
            if (availableSpecs[i] == null)
            {
                continue;
            }

            try
            {
                paramSpec = params.getParameterSpec(availableSpecs[i]);
                break;
            }
            catch (Exception e)
            {
                // try again if possible
            }
        }

        if (paramSpec == null)
        {
            throw new InvalidAlgorithmParameterException("can't handle parameter " + params.toString());
        }
    }

    engineInit(opmode, key, paramSpec, random);
    
    engineParams = params;
}
 
Example 16
Source File: PKCS12KeyStore.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals(pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return new AlgorithmId(algorithm).getName();
}
 
Example 17
Source File: PKCS12KeyStore.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return algorithm.toString();
}
 
Example 18
Source File: PKCS12KeyStore.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return algorithm.toString();
}
 
Example 19
Source File: CipherSpi.java    From ripple-lib-java with ISC License 5 votes vote down vote up
protected void engineInit(
    int                 opmode,
    Key                 key,
    AlgorithmParameters params,
    SecureRandom        random) 
throws InvalidKeyException, InvalidAlgorithmParameterException
{
    AlgorithmParameterSpec  paramSpec = null;

    if (params != null)
    {
        for (int i = 0; i != availableSpecs.length; i++)
        {
            try
            {
                paramSpec = params.getParameterSpec(availableSpecs[i]);
                break;
            }
            catch (Exception e)
            {
                continue;
            }
        }

        if (paramSpec == null)
        {
            throw new InvalidAlgorithmParameterException("can't handle parameter " + params.toString());
        }
    }

    engineParam = params;
    engineInit(opmode, key, paramSpec, random);
}
 
Example 20
Source File: PKCS12KeyStore.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return algorithm.toString();
}