Code example for KeyPair

Methods: getPrivategetPublic

0
        } 
    } 
 
    private void test_KeyPair(KeyPairGenerator kpg, KeyPair kp) throws Exception {
        assertNotNull(kp);
        test_Key(kpg, kp.getPrivate());
        test_Key(kpg, kp.getPublic());
    } 
 
    private void test_Key(KeyPairGenerator kpg, Key k) throws Exception {
        String expectedAlgorithm = kpg.getAlgorithm().toUpperCase();
        if (StandardNames.IS_RI && expectedAlgorithm.equals("DIFFIEHELLMAN")) {
            expectedAlgorithm = "DH";
        } 
        assertEquals(expectedAlgorithm, k.getAlgorithm().toUpperCase());
        assertNotNull(k.getEncoded());
        assertNotNull(k.getFormat());
 
        // Test serialization 
        { 
Stop searching for code, let great code find you!  Add Codota to your java IDE