1 #![allow(missing_docs)] 2 // Copyright 2023 Google LLC 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 16 //! This crate implements the connection part of UKEY2. Depending on context, the name UKEY2 may 17 //! include only the initial key handshake part (which is the historical origin of the name UKEY2), 18 //! but may also include the connection encryption part implemented in this crate. In some docs 19 //! this is also referred to as the "D2D" protocol. 20 //! 21 //! The main components in this crate are [`D2DHandshakeContext`] and [`D2DConnectionContextV1`]. 22 //! [`D2DHandshakeContext`] is a wrapper around the `ukey2_rs` crate, controlling the UKEY2 key 23 //! handshake for the context of the resulting connection. [`D2DConnectionContextV1`] can be created 24 //! from the handshake context once the handshake is complete, and controls the encryption and 25 //! decryption of the payload messages. 26 27 #![allow(clippy::expect_used)] 28 //TODO: remove this and fix instances of unwrap 29 #![allow(clippy::unwrap_used, clippy::panic)] 30 31 mod crypto_utils; 32 mod d2d_connection_context_v1; 33 mod d2d_handshake_context; 34 mod java_utils; 35 #[cfg(test)] 36 mod tests; 37 38 pub use d2d_connection_context_v1::{ 39 Aes256Key, D2DConnectionContextV1, DecodeError, DeserializeError, 40 }; 41 pub use d2d_handshake_context::{ 42 D2DHandshakeContext, HandleMessageError, HandshakeError, InitiatorD2DHandshakeContext, 43 ServerD2DHandshakeContext, 44 }; 45 pub use ukey2_rs::{HandshakeImplementation, NextProtocol}; 46