Code example for RSAPrivateKeySpec

0
     * Test for <code>RSAPrivateKeySpec(BigInteger,BigInteger)</code> ctor 
     * Assertion: constructs <code>RSAPrivateKeySpec</code> 
     * object using valid parameters 
     */ 
    public final void testRSAPrivateKeySpec() { 
        KeySpec ks = new RSAPrivateKeySpec(BigInteger.valueOf(1234567890L),
                                           BigInteger.valueOf(3L));
        assertTrue(ks instanceof RSAPrivateKeySpec);
    } 
 
    /** 
     * Test for <code>getModulus()</code> method<br> 
     * Assertion: returns modulus 
     */ 
    public final void testGetModulus() { 
        RSAPrivateKeySpec rpks =
            new RSAPrivateKeySpec(BigInteger.valueOf(1234567890L),
                                  BigInteger.valueOf(3L));
        assertEquals(1234567890L, rpks.getModulus().longValue());
    } 
Contextual code suggestions in your IDE  Get Codota for Java