1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use red_asn1::Asn1Object;
use red_asn1_derive::Sequence;
#[derive(Sequence, Default, Debug, Clone, PartialEq)]
pub struct KerbPaPacRequest {
#[seq_field(context_tag = 0)]
pub include_pac: bool,
}
impl KerbPaPacRequest {
pub fn new(include_pac: bool) -> Self {
return Self { include_pac };
}
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_encode_pac_request_true() {
assert_eq!(
vec![0x30, 0x05, 0xa0, 0x03, 0x01, 0x01, 0xff],
KerbPaPacRequest::new(true).build()
);
}
#[test]
fn test_encode_pac_request_false() {
assert_eq!(
vec![0x30, 0x05, 0xa0, 0x03, 0x01, 0x01, 0x00],
KerbPaPacRequest::new(false).build()
);
}
#[test]
fn test_decode_pac_request_true() {
assert_eq!(
KerbPaPacRequest::new(true),
KerbPaPacRequest::parse(&[0x30, 0x05, 0xa0, 0x03, 0x01, 0x01, 0xff])
.unwrap()
.1
);
}
#[test]
fn test_decode_pac_request_false() {
assert_eq!(
KerbPaPacRequest::new(false),
KerbPaPacRequest::parse(&[0x30, 0x05, 0xa0, 0x03, 0x01, 0x01, 0x00])
.unwrap()
.1
);
}
}