Search in sources :

Example 1 with AlgorithmParametersSpi

use of java.security.AlgorithmParametersSpi in project j2objc by google.

the class AlgorithmParametersTest method testAlgorithmParametersConst.

/**
     * Tests OAEP AlgorithmParameters provider
     *
    TODO(tball): enable when OAEP provider is implemented.
    public void testOAEPProvider() throws Exception {
        AlgorithmParameters params = AlgorithmParameters.getInstance("OAEP");

        assertEquals("Algorithm", "OAEP", params.getAlgorithm());
    }
    */
/**
     * Test for <code>AlgorithmParameters</code> constructor
     * Assertion: returns AlgorithmParameters object
     */
public void testAlgorithmParametersConst() throws Exception {
    AlgorithmParametersSpi spi = new MyAlgorithmParameters();
    AlgorithmParameters ap = new myAlgP(spi, p, "ABC");
    checkUnititialized(ap);
    ap.init(new byte[6], "aaa");
    checkAP(ap, p);
    //NULL parameters
    try {
        ap = new myAlgP(null, null, null);
    } catch (Exception e) {
        fail("Exception should be not thrown");
    }
}
Also used : AlgorithmParametersSpi(java.security.AlgorithmParametersSpi) IOException(java.io.IOException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) InvalidParameterSpecException(java.security.spec.InvalidParameterSpecException) NoSuchProviderException(java.security.NoSuchProviderException) AlgorithmParameters(java.security.AlgorithmParameters)

Example 2 with AlgorithmParametersSpi

use of java.security.AlgorithmParametersSpi in project robovm by robovm.

the class AlgorithmParametersTest method testAlgorithmParametersConst.

/**
     * Test for <code>AlgorithmParameters</code> constructor
     * Assertion: returns AlgorithmParameters object
     */
public void testAlgorithmParametersConst() throws Exception {
    AlgorithmParametersSpi spi = new MyAlgorithmParameters();
    AlgorithmParameters ap = new myAlgP(spi, p, "ABC");
    checkUnititialized(ap);
    ap.init(new byte[6], "aaa");
    checkAP(ap, p);
    //NULL parameters
    try {
        ap = new myAlgP(null, null, null);
    } catch (Exception e) {
        fail("Exception should be not thrown");
    }
}
Also used : AlgorithmParametersSpi(java.security.AlgorithmParametersSpi) IOException(java.io.IOException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) InvalidParameterSpecException(java.security.spec.InvalidParameterSpecException) NoSuchProviderException(java.security.NoSuchProviderException) AlgorithmParameters(java.security.AlgorithmParameters)

Aggregations

IOException (java.io.IOException)2 AlgorithmParameters (java.security.AlgorithmParameters)2 AlgorithmParametersSpi (java.security.AlgorithmParametersSpi)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 NoSuchProviderException (java.security.NoSuchProviderException)2 InvalidParameterSpecException (java.security.spec.InvalidParameterSpecException)2