Search in sources :

Example 6 with RSAOtherPrimeInfo

use of java.security.spec.RSAOtherPrimeInfo in project j2objc by google.

the class RSAMultiPrimePrivateCrtKeySpecTest method testIsStatePreserved2.

/**
     * Tests that internal state of the object
     * can not be modified using array reference
     * returned by <code>getOtherPrimeInfo()</code>
     * method
     */
public final void testIsStatePreserved2() {
    // Create initial array
    RSAOtherPrimeInfo[] opi1 = opi.clone();
    RSAMultiPrimePrivateCrtKeySpec ks = new RSAMultiPrimePrivateCrtKeySpec(BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, opi1);
    RSAOtherPrimeInfo[] ret = ks.getOtherPrimeInfo();
    // Modify returned array
    ret[2] = new RSAOtherPrimeInfo(BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO);
    // Check that above modification
    // does not affect internal state
    assertTrue(checkOtherPrimeInfo(ks.getOtherPrimeInfo()));
}
Also used : RSAOtherPrimeInfo(java.security.spec.RSAOtherPrimeInfo) RSAMultiPrimePrivateCrtKeySpec(java.security.spec.RSAMultiPrimePrivateCrtKeySpec)

Example 7 with RSAOtherPrimeInfo

use of java.security.spec.RSAOtherPrimeInfo in project j2objc by google.

the class RSAMultiPrimePrivateCrtKeySpecTest method testIsStatePreserved1.

//
// immutability tests
//
/**
     * Tests that internal state of the object
     * can not be modified by modifying initial array
     */
public final void testIsStatePreserved1() {
    // Create initial array
    RSAOtherPrimeInfo[] opi1 = opi.clone();
    RSAMultiPrimePrivateCrtKeySpec ks = new RSAMultiPrimePrivateCrtKeySpec(BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, opi1);
    // Modify initial array
    opi1[2] = new RSAOtherPrimeInfo(BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO);
    // Check that above modification
    // does not affect internal state
    assertTrue(checkOtherPrimeInfo(ks.getOtherPrimeInfo()));
}
Also used : RSAOtherPrimeInfo(java.security.spec.RSAOtherPrimeInfo) RSAMultiPrimePrivateCrtKeySpec(java.security.spec.RSAMultiPrimePrivateCrtKeySpec)

Example 8 with RSAOtherPrimeInfo

use of java.security.spec.RSAOtherPrimeInfo in project robovm by robovm.

the class RSAOtherPrimeInfoTest method testGetCrtCoefficient.

/**
     * Test for <code>getCrtCoefficient()</code> method<br>
     * Assertion: returns CRT coefficient value
     */
public final void testGetCrtCoefficient() {
    RSAOtherPrimeInfo ropi = new RSAOtherPrimeInfo(BigInteger.valueOf(1L), BigInteger.valueOf(2L), BigInteger.valueOf(3L));
    assertEquals(3L, ropi.getCrtCoefficient().longValue());
}
Also used : RSAOtherPrimeInfo(java.security.spec.RSAOtherPrimeInfo)

Example 9 with RSAOtherPrimeInfo

use of java.security.spec.RSAOtherPrimeInfo in project robovm by robovm.

the class RSAOtherPrimeInfoTest method testGetPrime.

/**
     * Test for <code>getPrime()</code> method<br>
     * Assertion: returns prime value
     */
public final void testGetPrime() {
    RSAOtherPrimeInfo ropi = new RSAOtherPrimeInfo(BigInteger.valueOf(1L), BigInteger.valueOf(2L), BigInteger.valueOf(3L));
    assertEquals(1L, ropi.getPrime().longValue());
}
Also used : RSAOtherPrimeInfo(java.security.spec.RSAOtherPrimeInfo)

Example 10 with RSAOtherPrimeInfo

use of java.security.spec.RSAOtherPrimeInfo in project robovm by robovm.

the class RSAOtherPrimeInfoTest method testGetExponent.

/**
     * Test for <code>getExponent()</code> method<br>
     * Assertion: returns prime exponent value
     */
public final void testGetExponent() {
    RSAOtherPrimeInfo ropi = new RSAOtherPrimeInfo(BigInteger.valueOf(1L), BigInteger.valueOf(2L), BigInteger.valueOf(3L));
    assertEquals(2L, ropi.getExponent().longValue());
}
Also used : RSAOtherPrimeInfo(java.security.spec.RSAOtherPrimeInfo)

Aggregations

RSAOtherPrimeInfo (java.security.spec.RSAOtherPrimeInfo)10 RSAMultiPrimePrivateCrtKeySpec (java.security.spec.RSAMultiPrimePrivateCrtKeySpec)4