forked from Qortal/qortal
Added ProxyKeys standalone for generating proxy keys
This commit is contained in:
parent
06095d633e
commit
978a22cab3
41
src/main/java/org/qora/ProxyKeys.java
Normal file
41
src/main/java/org/qora/ProxyKeys.java
Normal file
@ -0,0 +1,41 @@
|
||||
package org.qora;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.Security;
|
||||
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.bouncycastle.jsse.provider.BouncyCastleJsseProvider;
|
||||
import org.qora.account.PrivateKeyAccount;
|
||||
import org.qora.account.PublicKeyAccount;
|
||||
import org.qora.utils.Base58;
|
||||
|
||||
public class ProxyKeys {
|
||||
|
||||
private static void usage() {
|
||||
System.err.println("Usage: ProxyKeys <private-key> <public-key>");
|
||||
System.err.println("Example: ProxyKeys pYQ6DpQBJ2n72TCLJLScEvwhf3boxWy2kQEPynakwpj 6rNn9b3pYRrG9UKqzMWYZ9qa8F3Zgv2mVWrULGHUusb");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
public static void main(String argv[]) throws IOException {
|
||||
if (argv.length != 2)
|
||||
usage();
|
||||
|
||||
Security.insertProviderAt(new BouncyCastleProvider(), 0);
|
||||
Security.insertProviderAt(new BouncyCastleJsseProvider(), 1);
|
||||
|
||||
PrivateKeyAccount privateAccount = new PrivateKeyAccount(null, Base58.decode(argv[0]));
|
||||
PublicKeyAccount publicAccount = new PublicKeyAccount(null, Base58.decode(argv[1]));
|
||||
|
||||
byte[] proxyPrivateKey = privateAccount.getProxyPrivateKey(publicAccount.getPublicKey());
|
||||
|
||||
PrivateKeyAccount proxyAccount = new PrivateKeyAccount(null, proxyPrivateKey);
|
||||
|
||||
System.out.println(String.format("Private key account: %s", privateAccount.getAddress()));
|
||||
System.out.println(String.format("Public key account: %s", publicAccount.getAddress()));
|
||||
|
||||
System.out.println(String.format("Proxy private key: %s", Base58.encode(proxyAccount.getPrivateKey())));
|
||||
System.out.println(String.format("Proxy public key: %s", Base58.encode(proxyAccount.getPublicKey())));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user