mirror of
https://github.com/tlsnotary/tlsn.git
synced 2026-04-28 03:00:14 -04:00
update tls-core and -aio
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
use tls_core::{
|
||||
key::PublicKey,
|
||||
msgs::{handshake::Random, message::PlainMessage},
|
||||
};
|
||||
use tls_core::{key::PublicKey, msgs::handshake::Random};
|
||||
|
||||
use async_trait::async_trait;
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
use std::fmt;
|
||||
|
||||
use crate::msgs::enums::NamedGroup;
|
||||
|
||||
/// This type contains a private key by value.
|
||||
///
|
||||
/// The private key must be DER-encoded ASN.1 in either
|
||||
@@ -33,6 +35,31 @@ impl fmt::Debug for Certificate {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct PublicKey {
|
||||
pub group: NamedGroup,
|
||||
pub key: Vec<u8>,
|
||||
}
|
||||
|
||||
impl PublicKey {
|
||||
pub fn new(group: NamedGroup, key: &[u8]) -> Self {
|
||||
Self {
|
||||
group,
|
||||
key: Vec::from(key),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<crate::msgs::handshake::KeyShareEntry> for PublicKey {
|
||||
#[inline]
|
||||
fn from(k: crate::msgs::handshake::KeyShareEntry) -> Self {
|
||||
Self {
|
||||
group: k.group,
|
||||
key: k.payload.0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::Certificate;
|
||||
|
||||
@@ -403,6 +403,13 @@ impl Codec for KeyShareEntry {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<crate::key::PublicKey> for KeyShareEntry {
|
||||
#[inline]
|
||||
fn from(k: crate::key::PublicKey) -> Self {
|
||||
Self::new(k.group, &k.key)
|
||||
}
|
||||
}
|
||||
|
||||
// --- TLS 1.3 PresharedKey offers ---
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct PresharedKeyIdentity {
|
||||
|
||||
Reference in New Issue
Block a user