finish server side cert auth and motd

This commit is contained in:
Toshit Chawda 2024-09-14 17:47:16 -07:00
parent 01ff6ee956
commit 577ce71b89
No known key found for this signature in database
GPG key ID: 91480ED99E2B3D9D
10 changed files with 199 additions and 38 deletions

View file

@ -69,12 +69,12 @@ pub struct VerifyKey {
/// SHA-512 hash of the public key.
pub hash: [u8; 64],
/// Verifier.
pub verifier: Arc<dyn Verifier<Signature>>,
pub verifier: Arc<dyn Verifier<Signature> + Sync + Send>,
}
impl VerifyKey {
/// Create a new ED25519 verification key.
pub fn new_ed25519(verifier: Arc<dyn Verifier<Signature>>, hash: [u8; 64]) -> Self {
pub fn new_ed25519(verifier: Arc<dyn Verifier<Signature> + Sync + Send>, hash: [u8; 64]) -> Self {
Self {
cert_type: SupportedCertificateTypes::Ed25519,
hash,
@ -91,11 +91,11 @@ pub struct SigningKey {
/// SHA-512 hash of the public key.
pub hash: [u8; 64],
/// Signer.
pub signer: Arc<dyn Signer<Signature>>,
pub signer: Arc<dyn Signer<Signature> + Sync + Send>,
}
impl SigningKey {
/// Create a new ED25519 signing key.
pub fn new_ed25519(signer: Arc<dyn Signer<Signature>>, hash: [u8; 64]) -> Self {
pub fn new_ed25519(signer: Arc<dyn Signer<Signature> + Sync + Send>, hash: [u8; 64]) -> Self {
Self {
cert_type: SupportedCertificateTypes::Ed25519,
hash,
@ -234,6 +234,18 @@ pub enum CertAuthProtocolExtensionBuilder {
},
}
impl CertAuthProtocolExtensionBuilder {
/// Create a new server variant of the certificate authentication protocol extension.
pub fn new_server(verifiers: Vec<VerifyKey>) -> Self {
Self::ServerBeforeChallenge { verifiers }
}
/// Create a new client variant of the certificate authentication protocol extension.
pub fn new_client(signer: SigningKey) -> Self {
Self::ClientBeforeChallenge { signer }
}
}
#[async_trait]
impl ProtocolExtensionBuilder for CertAuthProtocolExtensionBuilder {
fn get_id(&self) -> u8 {