aboutsummaryrefslogtreecommitdiffhomepage
path: root/oxish-proto
diff options
context:
space:
mode:
Diffstat (limited to 'oxish-proto')
-rw-r--r--oxish-proto/src/key_exchange.rs8
-rw-r--r--oxish-proto/src/named.rs10
2 files changed, 17 insertions, 1 deletions
diff --git a/oxish-proto/src/key_exchange.rs b/oxish-proto/src/key_exchange.rs
index 898fb46..e2acb98 100644
--- a/oxish-proto/src/key_exchange.rs
+++ b/oxish-proto/src/key_exchange.rs
@@ -83,6 +83,11 @@ impl Rekey {
pub fn strict_key_exchange(&self) -> Option<&StrictKeyExchange> {
self.strict_kx.as_ref()
}
+
+ /// The client's identity
+ pub fn client_identity(&self) -> &[u8] {
+ &self.identities.client
+ }
}
/// Output from the initial key exchange phase
@@ -746,7 +751,8 @@ impl fmt::Debug for TaggedSignature<'_> {
/// See <https://www.rfc-editor.org/rfc/rfc4253#section-7.1> for the negotiation procedure.
#[derive(Debug)]
pub struct Negotiated {
- key_exchange: KeyExchangeAlgorithm<'static>,
+ /// Negotiated key exchange algorithm
+ pub key_exchange: KeyExchangeAlgorithm<'static>,
server_host_key: PublicKeyAlgorithm<'static>,
encryption_client_to_server: EncryptionAlgorithm<'static>,
encryption_server_to_client: EncryptionAlgorithm<'static>,
diff --git a/oxish-proto/src/named.rs b/oxish-proto/src/named.rs
index 4b24417..b87cec5 100644
--- a/oxish-proto/src/named.rs
+++ b/oxish-proto/src/named.rs
@@ -188,6 +188,16 @@ pub enum KeyExchangeAlgorithm<'a> {
Unknown(&'a str),
}
+impl KeyExchangeAlgorithm<'_> {
+ /// Whether it's secure against attacks with a cryptographically relevant quantum computer
+ pub fn post_quantum_secure(&self) -> bool {
+ match self {
+ Self::MlKem768X25519Sha256 => true,
+ Self::Curve25519Sha256 | Self::Unknown(_) => false,
+ }
+ }
+}
+
impl<'a> Named<'a> for KeyExchangeAlgorithm<'a> {
fn typed(name: &'a str) -> Self {
match name {