[−][src]Module activeledger::key::import
Importer
The importer module is used to import keys from files.
The file passed to the importer must be JSON that matches the expected structure.
Currently RSA and EC (SECP256K1) keys can be imported.
Examples
This example will use an RSA key as an example but other keys should use the same process. Examples will be provided if this is not the case. Alternative functions will be listed at the end of the example.
let rsa_key_path = "/path/to/key.json"; let rsa = import::import_rsa(&rsa_key_path).unwrap();
The other functions for key importing are:
import::import_ec(ec_key_path).unwrap();
File Structure
The file you import should have the following structure, otherwise the import will fail.
{
"name":"",
"type":"",
"pem": {
"private": "",
"public":""
}
}
Functions
import_ec | Import an EC (SECP256K1) key from the specified file. |
import_rsa | Import an RSA key from the specified file. |