mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-12 14:00:01 -04:00
finish server side cert auth and motd
This commit is contained in:
parent
01ff6ee956
commit
577ce71b89
10 changed files with 199 additions and 38 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue