Search in sources :

Example 16 with RSAMultiPrimePrivateCrtKeySpec

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

the class RSAMultiPrimePrivateCrtKeySpecTest method testGetModulus.

//
// Tests for inherited methods
//
/**
     * Test for <code>getModulus()</code> method<br>
     * Assertion: returns modulus
     */
public final void testGetModulus() {
    RSAMultiPrimePrivateCrtKeySpec ks = new RSAMultiPrimePrivateCrtKeySpec(BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, opi);
    assertTrue(BigInteger.ONE.equals(ks.getModulus()));
}
Also used : RSAMultiPrimePrivateCrtKeySpec(java.security.spec.RSAMultiPrimePrivateCrtKeySpec)

Example 17 with RSAMultiPrimePrivateCrtKeySpec

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

the class RSAMultiPrimePrivateCrtKeySpecTest method testGetPublicExponent.

/**
     * Test for <code>getPublicExponent()</code> method<br>
     * Assertion: returns public exponent
     */
public final void testGetPublicExponent() {
    RSAMultiPrimePrivateCrtKeySpec ks = new RSAMultiPrimePrivateCrtKeySpec(BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, opi);
    assertTrue(BigInteger.ONE.equals(ks.getPublicExponent()));
}
Also used : RSAMultiPrimePrivateCrtKeySpec(java.security.spec.RSAMultiPrimePrivateCrtKeySpec)

Example 18 with RSAMultiPrimePrivateCrtKeySpec

use of java.security.spec.RSAMultiPrimePrivateCrtKeySpec 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 19 with RSAMultiPrimePrivateCrtKeySpec

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

the class RSAMultiPrimePrivateCrtKeySpecTest method testGetPrimeP.

/**
     * Test for <code>getPrimeP()</code> method<br>
     * Assertion: returns prime P
     */
public final void testGetPrimeP() {
    RSAMultiPrimePrivateCrtKeySpec ks = new RSAMultiPrimePrivateCrtKeySpec(BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, opi);
    assertTrue(BigInteger.ONE.equals(ks.getPrimeP()));
}
Also used : RSAMultiPrimePrivateCrtKeySpec(java.security.spec.RSAMultiPrimePrivateCrtKeySpec)

Example 20 with RSAMultiPrimePrivateCrtKeySpec

use of java.security.spec.RSAMultiPrimePrivateCrtKeySpec 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)

Aggregations

RSAMultiPrimePrivateCrtKeySpec (java.security.spec.RSAMultiPrimePrivateCrtKeySpec)28 KeySpec (java.security.spec.KeySpec)4 RSAOtherPrimeInfo (java.security.spec.RSAOtherPrimeInfo)4 RSAPrivateKeySpec (java.security.spec.RSAPrivateKeySpec)4