@Test
public void testCreatePrivateKey() throws Exception {

  final ECDSAKeyGenerator generator = new ECDSAKeyGenerator();
  final ECDSAKey key = generator.create();
  final org.bouncycastle.jce.interfaces.ECPrivateKey ecPrivateKey =
      (org.bouncycastle.jce.interfaces.ECPrivateKey) key.getPrivateKey();
  final PrivateKey recovered = generator.createPrivateKey(ecPrivateKey.getD());
  assertEquals(ecPrivateKey.getD(),
      ((org.bouncycastle.jce.interfaces.ECPrivateKey) recovered).getD());
}