[−][src]Module activeledger::key::export
Exporter
The exporter module provides the ability to export keys generated by the SDK (or imported via the importer module)
Currently RSA and EC (SECP256K1) keys can be exported
Examples
For this example we will be using an RSA key example but other keys will be similar, the alternative functions are listed at the end of the example.
let rsa = RSA::new("Key name").unwrap(); let path = "export/path/file.json"; // Pass a reference of the key and write path to the exporter export::export_rsa(&rsa, path).unwrap(); // Note! The path must include the file name!
The other functions for key exporting are:
export::export_ec(&ec, path).unwrap();
File Structure
The file that is exported will have the following JSON structure
{
"name":"",
"type":"",
"pem": {
"private": "",
"public":""
}
}
Functions
export_ec | Export an EC key to the specified location.Key. |
export_rsa | Export an RSA key to the specified location.Key. |