cred-helper done
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "cred-helper"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
zeroize = "1.8.1"
|
||||
sha2 = "0.10.8"
|
||||
hkdf = "0.12.4"
|
||||
aes-gcm = "0.10.3"
|
||||
rsa = "0.9.8"
|
||||
x25519-dalek = "2.0.1"
|
||||
ed25519-dalek = {version="2.1.1", features=["rand_core", "serde", "pkcs8", "alloc", "pem", "std"]}
|
||||
rand = "0.9.1"
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
use std::{fs::File, io::Write};
|
||||
use ed25519_dalek::pkcs8::EncodePrivateKey;
|
||||
|
||||
use aes_gcm::aead::OsRng;
|
||||
use ed25519_dalek::pkcs8::EncodePublicKey;
|
||||
use ed25519_dalek::{SigningKey, VerifyingKey};
|
||||
use rsa::pkcs1::{EncodeRsaPrivateKey, EncodeRsaPublicKey};
|
||||
|
||||
fn main() {
|
||||
println!("generating credentials for use with the remainder of the tooling for the Vault of Oblivion");
|
||||
|
||||
let mut csprng = OsRng;
|
||||
let sign_private_key: SigningKey = SigningKey::generate(&mut csprng);
|
||||
let verif_public_key: VerifyingKey = sign_private_key.verifying_key();
|
||||
let pem_private = sign_private_key.to_pkcs8_pem(rsa::pkcs8::LineEnding::LF).unwrap();
|
||||
let pem_public = verif_public_key.to_public_key_pem(rsa::pkcs8::LineEnding::LF).unwrap();
|
||||
|
||||
// write to corresponding files
|
||||
let mut public_key_file: File = File::create("ed25519-pub.pem").unwrap();
|
||||
let mut private_key_file: File = File::create("ed25519-private.pem").unwrap();
|
||||
|
||||
public_key_file.write_all(pem_public.as_bytes()).unwrap();
|
||||
private_key_file.write_all(pem_private.as_bytes()).unwrap();
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user