@Test
public void testCreatePublicKey() throws Exception {

  final ECDSAKeyGenerator generator = new ECDSAKeyGenerator();
  final ECDSAKey key = generator.create();
  final org.bouncycastle.jce.interfaces.ECPublicKey ecPublicKey =
      (org.bouncycastle.jce.interfaces.ECPublicKey) key.getPublicKey();
  final PublicKey recovered =
      generator.createPublicKey(ecPublicKey.getQ().getXCoord().toBigInteger(),
          ecPublicKey.getQ().getYCoord().toBigInteger());
  assertEquals(ecPublicKey.getQ(),
      ((org.bouncycastle.jce.interfaces.ECPublicKey) recovered).getQ());
}