PrivateKey { public byte[] getValue() { return privateKey.clone(); } PrivateKey();  PrivateKey(byte[] src);  PrivateKey(String seed); boolean isValid(); byte[] getValue(); @Override String toString();  }
@Test public void testDefaultConstructor(){ PrivateKey privateKey = new PrivateKey(); Assert.assertTrue(privateKey.getValue() != null); }
@Test public void testConstructorFromByteArray(){ PrivateKey privateKey = new PrivateKey("test".getBytes()); Assert.assertTrue(privateKey.getValue() != null); }
@Test public void testConstructorFromSeed(){ PrivateKey privateKey = new PrivateKey("Seed"); Assert.assertTrue(privateKey.getValue() != null); }
@Test public void testGeneratePrivateKeyFromString() { String seed = "Lorem ipsum dolor sit amet, ei quo equidem perpetua efficiendi"; PrivateKey privKey = new PrivateKey(seed); System.out.println(Util.byteArrayToHexString(privKey.getValue())); System.out.println(Util.byteArrayToHexString(new PublicKey(privKey).getValue())); ECCryptoService ecCryptoService = AppServiceProvider.getECCryptoService(); TestCase.assertEquals( "00948c6246ebb299414ccd3cc8b17674d3f6fe0d14b984b6c2c84e0d5866a38da2", Util.byteArrayToHexString(privKey.getValue())); TestCase.assertEquals(1, new BigInteger(1, privKey.getValue()).compareTo(BigInteger.ZERO)); TestCase.assertEquals(-1, new BigInteger(1, privKey.getValue()).compareTo(ecCryptoService.getN())); }