diff --git a/crates/core/src/bc/de.rs b/crates/core/src/bc/de.rs index d546f18..46d998b 100644 --- a/crates/core/src/bc/de.rs +++ b/crates/core/src/bc/de.rs @@ -268,6 +268,47 @@ mod tests { } } + #[test] + // This is an 0xdd03 encryption from an Argus 2 + // + // It is currently unsupported + fn test_03_enc_login() { + let sample = include_bytes!("samples/battery_enc.bin"); + + let encryption_protocol = + std::sync::Arc::new(std::sync::Mutex::new(EncryptionProtocol::BCEncrypt)); + let mut context = BcContext::new(encryption_protocol); + + let (buf, header) = bc_header(&sample[..]).unwrap(); + assert!(bc_body(&mut context, &header, buf).is_err()); + // It should error because we don't support it + // + // The following would be its contents if we + // did support it (maybe one day :) left it here + // for then) + // + // + // let (_, body) = bc_body(&mut context, &header, buf).unwrap(); + // assert_eq!(header.msg_id, 1); + // assert_eq!(header.body_len, 175); + // assert_eq!(header.channel_id, 0); + // assert_eq!(header.stream_type, 0); + // assert_eq!(header.payload_offset, None); + // assert_eq!(header.response_code, 0xdd03); + // assert_eq!(header.class, 0x6614); + // match body { + // BcBody::ModernMsg(ModernMsg { + // payload: + // Some(BcPayloads::BcXml(BcXml { + // encryption: Some(encryption), + // .. + // })), + // .. + // }) => assert_eq!(encryption.nonce, "0-AhnEZyUg6eKrJFIWgXPF"), + // _ => panic!(), + // } + } + #[test] fn test_bc_legacy_login() { let sample = include_bytes!("samples/model_sample_legacy_login.bin"); diff --git a/crates/core/src/bc/samples/battery_enc.bin b/crates/core/src/bc/samples/battery_enc.bin new file mode 100644 index 0000000..8c9514c Binary files /dev/null and b/crates/core/src/bc/samples/battery_enc.bin differ diff --git a/crates/core/src/bc_protocol/login.rs b/crates/core/src/bc_protocol/login.rs index f8550fd..2a61ad0 100644 --- a/crates/core/src/bc_protocol/login.rs +++ b/crates/core/src/bc_protocol/login.rs @@ -35,7 +35,7 @@ impl BcCamera { channel_id: self.channel_id, msg_num: self.new_message_num(), stream_type: 0, - response_code: 0xdc03, + response_code: 0xdc02, class: 0x6514, }, body: BcBody::LegacyMsg(LegacyMsg::LoginMsg {