Avoid problems with exact location of notary keys

This commit is contained in:
Hendrik Eeckhaut
2023-10-20 17:46:36 +02:00
parent 5eb52b824f
commit 9cbf67fd43
3 changed files with 7 additions and 11 deletions

View File

@@ -1,3 +0,0 @@
fn main() {
println!("Hello, world!");
}

View File

@@ -1,15 +1,13 @@
/// This is a simple implementation of the notary server with minimal functionalities (without TLS, does not support WebSocket and configuration etc.)
/// For a more functional notary server implementation, please use the notary server in `../../notary-server`
use p256::pkcs8::DecodePrivateKey;
use std::env;
use std::{env, str};
use tokio::net::TcpListener;
use tokio_util::compat::TokioAsyncReadCompatExt;
use tlsn_verifier::tls::{Verifier, VerifierConfig};
const NOTARY_SIGNING_KEY_PATH: &str = "./notary/notary.key";
#[tokio::main]
async fn main() {
tracing_subscriber::fmt::init();
@@ -29,8 +27,8 @@ async fn main() {
println!("Listening on: {}", addr);
// Load the notary signing key
let signing_key =
p256::ecdsa::SigningKey::read_pkcs8_pem_file(NOTARY_SIGNING_KEY_PATH).unwrap();
let signing_key_str = str::from_utf8(include_bytes!("./notary/notary.key")).unwrap();
let signing_key = p256::ecdsa::SigningKey::from_pkcs8_pem(signing_key_str).unwrap();
loop {
// Asynchronously wait for an inbound socket.

View File

@@ -4,6 +4,8 @@ use elliptic_curve::pkcs8::DecodePublicKey;
use tlsn_core::proof::{SessionProof, TlsProof};
use std::str;
/// A simple verifier which reads a proof generated by `simple_prover.rs` from "proof.json", verifies
/// it and prints the verified data to the console.
fn main() {
@@ -67,7 +69,6 @@ fn main() {
/// Returns a Notary pubkey trusted by this Verifier
fn notary_pubkey() -> p256::PublicKey {
let pem_file_path = "./notary/notary.pub";
p256::PublicKey::read_public_key_pem_file(pem_file_path).unwrap()
let pem_file = str::from_utf8(include_bytes!("./notary/notary.pub")).unwrap();
p256::PublicKey::from_public_key_pem(pem_file).unwrap()
}