Update KeyPair.java

Fix:
If a new KeyPair was created based on an existing PrivateKey the publicKey-field stayed null forever. Each time .getPublicKey() was called the PublicKey gets recalculated.

Moved this code in the constructor where it belongs to.
Unit test to reproduce the public key issue
Refactoring unit test with the real issue