Code example for KeyPair

Methods: getPrivate, getPublic

0
        } catch (NoSuchAlgorithmException ex) {
            Logger.getLogger(GenereazaCheie.class.getName()).log(Level.SEVERE, null, ex);
        } 
        kpg.initialize(1024);
        KeyPair kp = kpg.genKeyPair();
        publicKey = kp.getPublic();
        privateKey = kp.getPrivate();
    } 
    public Key getPrivateKey() {
        return privateKey;
    } 
 
    public Key getPublicKey() {
        return publicKey;
    } 
 
 
 
 
}