Search in sources :

Example 11 with WalletKeyPair

use of snowblossom.proto.WalletKeyPair in project snowblossom by snowblossomcoin.

the class CipherUtilTest method testECCurves.

@Test
public void testECCurves() throws Exception {
    for (String curve : SignatureUtil.ALLOWED_ECDSA_CURVES) {
        WalletKeyPair wkp = KeyUtil.generateWalletECKey(curve);
        testKeys(wkp);
    }
}
Also used : WalletKeyPair(snowblossom.proto.WalletKeyPair) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 12 with WalletKeyPair

use of snowblossom.proto.WalletKeyPair in project snowblossom by snowblossomcoin.

the class CipherUtilTest method testECCompressed.

/*@Test
  public void testDSA()
    throws Exception
  {
    WalletKeyPair wkp = KeyUtil.generateWalletDSAKey();
    testKeys(wkp);
  }*/
/*@Test
  public void testRSA()
    throws Exception
  {
    WalletKeyPair wkp = KeyUtil.generateWalletRSAKey(1024);
    testKeys(wkp);
  }*/
@Test
public void testECCompressed() throws Exception {
    WalletKeyPair wkp = KeyUtil.generateWalletStandardECKey();
    testKeys(wkp);
}
Also used : WalletKeyPair(snowblossom.proto.WalletKeyPair) Test(org.junit.Test)

Example 13 with WalletKeyPair

use of snowblossom.proto.WalletKeyPair in project snowblossom by snowblossomcoin.

the class KeyUtilTest method testRSA.

@Test
public void testRSA() throws Exception {
    for (int i = 512; i <= 2 * 1024; i *= 2) {
        logger.info("Generating key size: " + i);
        WalletKeyPair wkp = KeyUtil.generateWalletRSAKey(i);
        logger.info(KeyUtil.decomposeASN1Encoded(wkp.getPublicKey()));
        logger.info("Testing key size: " + i);
        testKeyPair(wkp, "RSA " + i);
    }
}
Also used : WalletKeyPair(snowblossom.proto.WalletKeyPair) Test(org.junit.Test)

Example 14 with WalletKeyPair

use of snowblossom.proto.WalletKeyPair in project snowblossom by snowblossomcoin.

the class KeyUtilTest method testAllowedCurvesByName.

@Test
public void testAllowedCurvesByName() throws Exception {
    ArrayList<String> curves = new ArrayList<>();
    curves.add("secp256k1");
    curves.add("secp384r1");
    curves.add("secp521r1");
    curves.add("sect571k1");
    curves.add("sect571r1");
    for (String curve : curves) {
        WalletKeyPair wkp = KeyUtil.generateWalletECKey(curve);
        testKeyPair(wkp, curve);
    }
}
Also used : WalletKeyPair(snowblossom.proto.WalletKeyPair) ArrayList(java.util.ArrayList) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 15 with WalletKeyPair

use of snowblossom.proto.WalletKeyPair in project snowblossom by snowblossomcoin.

the class KeyUtilTest method testDSTU4145.

@Test
public void testDSTU4145() throws Exception {
    for (int i = 0; i <= 9; i++) {
        logger.info("Testing DSTU key size: " + i);
        WalletKeyPair wkp = KeyUtil.generateWalletDSTU4145Key(i);
        logger.info(KeyUtil.decomposeASN1Encoded(wkp.getPublicKey()));
        testKeyPair(wkp, "DSTU " + i);
    }
}
Also used : WalletKeyPair(snowblossom.proto.WalletKeyPair) Test(org.junit.Test)

Aggregations

WalletKeyPair (snowblossom.proto.WalletKeyPair)19 ByteString (com.google.protobuf.ByteString)9 Test (org.junit.Test)8 KeyPair (java.security.KeyPair)2 ECGenParameterSpec (java.security.spec.ECGenParameterSpec)2 RSAKeyGenParameterSpec (java.security.spec.RSAKeyGenParameterSpec)2 AddressSpec (snowblossom.proto.AddressSpec)2 X509Certificate (java.security.cert.X509Certificate)1 ECParameterSpec (java.security.spec.ECParameterSpec)1 PKCS8EncodedKeySpec (java.security.spec.PKCS8EncodedKeySpec)1 X509EncodedKeySpec (java.security.spec.X509EncodedKeySpec)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Random (java.util.Random)1 Cipher (javax.crypto.Cipher)1 ChildNumber (org.bitcoinj.crypto.ChildNumber)1 DeterministicHierarchy (org.bitcoinj.crypto.DeterministicHierarchy)1 DeterministicKey (org.bitcoinj.crypto.DeterministicKey)1