kerberos_asn1/pa_data/
pa_pac_options.rs

1use crate::KerberosFlags;
2use red_asn1::Asn1Object;
3use red_asn1_derive::Sequence;
4
5/// (*PA-PAC-OPTIONS*) To request options of the PAC.
6/// Defined in MS-KILE, section 2.2.10 and MS-SFU, section 2.2.5.
7/// ```asn1
8/// PA-PAC-OPTIONS ::= SEQUENCE {
9///     KerberosFlags
10///       --Claims (0)
11///       --Branch Aware (1)
12///       --Forward to Full DC (2)
13///       -- resource-based constrained delegation (3)
14/// }
15/// ```
16#[derive(Sequence, Default, Debug, Clone, PartialEq)]
17pub struct PaPacOptions {
18    #[seq_field(context_tag = 0)]
19    pub kerberos_flags: KerberosFlags,
20}
21
22#[cfg(test)]
23mod tests {
24    use super::*;
25
26    #[test]
27    fn test_build_pa_pac_options() {
28        let options = PaPacOptions {
29            kerberos_flags: 0x10000000.into(),
30        };
31        assert_eq!(
32            vec![
33                0x30, 0x09, 0xa0, 0x07, 0x03, 0x05, 0x00, 0x10, 0x00, 0x00,
34                0x00
35            ],
36            options.build()
37        )
38    }
39
40    #[test]
41    fn test_parse_pa_pac_options() {
42        let options = PaPacOptions {
43            kerberos_flags: 0x10000000.into(),
44        };
45        assert_eq!(
46            options,
47            PaPacOptions::parse(&[
48                0x30, 0x09, 0xa0, 0x07, 0x03, 0x05, 0x00, 0x10, 0x00, 0x00,
49                0x00
50            ])
51            .unwrap()
52            .1
53        )
54    }
55}