• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #![deny(missing_docs)]
28 
29 mod crypto_utils;
30 mod d2d_connection_context_v1;
31 mod d2d_handshake_context;
32 mod java_utils;
33 #[cfg(test)]
34 mod tests;
35 
36 pub use d2d_connection_context_v1::{
37     Aes256Key, D2DConnectionContextV1, DecodeError, DeserializeError,
38 };
39 pub use d2d_handshake_context::{
40     D2DHandshakeContext, HandleMessageError, HandshakeError, InitiatorD2DHandshakeContext,
41     ServerD2DHandshakeContext,
42 };
43 pub use ukey2_rs::HandshakeImplementation;
44