fix tab/space

This commit is contained in:
occheung 2020-10-21 18:18:54 +08:00
parent 5986777770
commit eadf776da3
8 changed files with 1689 additions and 1686 deletions

View File

@ -12,6 +12,7 @@ num_enum = { version = "0.5.1", default-features = false }
log = "0.4.11"
generic-array = "0.14.4"
heapless = "0.5.6"
asn1_der = { version = "0.7.1", features = [ "native_types", "no_std" ] }
[dependencies.aes-gcm]
version = "0.8.0"

View File

@ -9,12 +9,15 @@ pub mod parse;
pub mod buffer;
pub mod key;
pub mod session;
pub mod certificate;
use nom::error::ParseError;
// TODO: Implement errors
// Details: Encapsulate smoltcp & nom errors
pub enum Error {
PropagatedError(smoltcp::Error),
ParsingError,
ParsingError(nom::error::ErrorKind),
EncryptionError,
DecryptionError,
CapacityError,

View File

@ -22,11 +22,10 @@ use hkdf::Hkdf;
use smoltcp_tls::key::*;
use smoltcp_tls::buffer::TlsBuffer;
use asn1_der::{
DerObject,
typed::{ DerEncodable, DerDecodable }
};
use smoltcp_tls::certificate::*;
use asn1_der::DerObject;
use smoltcp_tls::parse::*;
struct CountingRng(u64);
@ -78,14 +77,14 @@ fn main() {
).unwrap();
// tls_socket.tls_connect(&mut sockets).unwrap();
let object = DerObject::decode(&CERT).expect("Failed to decode object");
println!("raw: {:2X?},\nheader: {:2X?},\ntag: {:2X?},\nvalue: {:2X?}\n",
object.raw(),
object.header(),
object.tag(),
object.value()
let (rest, result) = parse_asn1_der_certificate(&CERT).unwrap();
println!(
"{:X?}\n{:X?}\n{:X?}\n{:X?}",
rest,
result.0,
result.1,
result.2
);
}
const CERT: [u8; 805] = [