Package foundation.icon.icx
Class KeyWallet
- java.lang.Object
-
- foundation.icon.icx.KeyWallet
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static KeyWallet
create()
Creates a new KeyWallet with generating a new key pair.Address
getAddress()
Gets the address corresponding the key of the walletBytes
getPrivateKey()
Gets the private keyBytes
getPublicKey()
static KeyWallet
load(Bytes privateKey)
Loads a key wallet from the private keystatic KeyWallet
load(java.lang.String password, java.io.File file)
Loads a key wallet from the KeyStore filebyte[]
sign(byte[] data)
Signs the data to generate a signaturestatic java.lang.String
store(KeyWallet wallet, java.lang.String password, java.io.File destinationDirectory)
Stores the KeyWallet as a KeyStore
-
-
-
Method Detail
-
load
public static KeyWallet load(Bytes privateKey)
Loads a key wallet from the private key- Parameters:
privateKey
- the private key to load- Returns:
- KeyWallet
-
create
public static KeyWallet create() throws java.security.InvalidAlgorithmParameterException, java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException
Creates a new KeyWallet with generating a new key pair.- Returns:
- new KeyWallet
- Throws:
java.security.InvalidAlgorithmParameterException
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
-
load
public static KeyWallet load(java.lang.String password, java.io.File file) throws java.io.IOException, KeystoreException
Loads a key wallet from the KeyStore file- Parameters:
password
- the password of KeyStorefile
- the KeyStore file- Returns:
- KeyWallet
- Throws:
java.io.IOException
KeystoreException
-
store
public static java.lang.String store(KeyWallet wallet, java.lang.String password, java.io.File destinationDirectory) throws KeystoreException, java.io.IOException
Stores the KeyWallet as a KeyStore- Parameters:
wallet
- the wallet to storepassword
- the password of KeyStoredestinationDirectory
- the KeyStore file is stored at.- Returns:
- name of the KeyStore file
- Throws:
KeystoreException
java.io.IOException
-
getAddress
public Address getAddress()
Description copied from interface:Wallet
Gets the address corresponding the key of the wallet- Specified by:
getAddress
in interfaceWallet
- Returns:
- address
- See Also:
Wallet.getAddress()
-
sign
public byte[] sign(byte[] data)
Description copied from interface:Wallet
Signs the data to generate a signature- Specified by:
sign
in interfaceWallet
- Parameters:
data
- to sign- Returns:
- signature
- See Also:
Wallet.sign(byte[])
-
getPrivateKey
public Bytes getPrivateKey()
Gets the private key- Returns:
- private key
-
getPublicKey
public Bytes getPublicKey()
-
-