Code example for KeyPairGenerator

Methods: generateKeyPair

0
 
	public String generate_keypair() { 
		if ( kpg == null ) 
			return null ;  
		 
		keyPair = kpg.generateKeyPair() ; 
		if ( keyPair == null) 
			return null ;  
		 
		publicKey = keyPair.getPublic() ; 
		privateKey = keyPair.getPrivate() ; 
		 
		if ( (publicKey == null) || (privateKey == null)) { 
			return null ;  
		} 
		return Base64.encodeToString(publicKey.getEncoded(),0); 
	} 
	 
	 
	 
	public String encrypt_data(String data, String pKey) {