Search in sources :

Example 1 with KeyPairObj

use of com.hedera.services.legacy.core.KeyPairObj in project hedera-services by hashgraph.

the class Base64KeyPairGen method main.

public static void main(String... args) throws IOException {
    String privateKeyHex = "302e020100300506032b6570042204204cc2d50f9449affc43e851b8d4338f98c50ff5c56cb3c741f3f9b3d075a709fd";
    String publicKeyHex = "302a300506032b657003210034171a7d250b6a41cc2355eeb3e36919bace1f848b14341daa4ab4b67c337a00";
    String account = "0.0.950";
    KeyPairObj tempKeyPair = new KeyPairObj(publicKeyHex, privateKeyHex);
    AccountKeyListObj tempAccountKeyListObj = new AccountKeyListObj(HapiPropertySource.asAccount(account), List.of(tempKeyPair));
    Map<String, List<AccountKeyListObj>> tempMap = Map.of("START_ACCOUNT", List.of(tempAccountKeyListObj));
    ByteArrayOutputStream tempByteAS = new ByteArrayOutputStream();
    ObjectOutputStream tempObjS = new ObjectOutputStream(tempByteAS);
    tempObjS.writeObject(tempMap);
    tempObjS.close();
    ByteSink byteSink = Files.asByteSink(new File("NewStartUpAccount.txt"));
    byteSink.write(CommonUtils.base64encode(tempByteAS.toByteArray()).getBytes());
}
Also used : ByteSink(com.google.common.io.ByteSink) KeyPairObj(com.hedera.services.legacy.core.KeyPairObj) List(java.util.List) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectOutputStream(java.io.ObjectOutputStream) File(java.io.File) AccountKeyListObj(com.hedera.services.legacy.core.AccountKeyListObj)

Aggregations

ByteSink (com.google.common.io.ByteSink)1 AccountKeyListObj (com.hedera.services.legacy.core.AccountKeyListObj)1 KeyPairObj (com.hedera.services.legacy.core.KeyPairObj)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 ObjectOutputStream (java.io.ObjectOutputStream)1 List (java.util.List)1