ace_uds/message/services/authentication/
request.rs1use crate::UdsError;
2use ace_macros::FrameCodec;
3
4#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, FrameCodec)]
5#[frame(error = UdsError)]
6pub enum AuthenticationRequest<'a> {
7 #[frame(id = 0x00)]
8 DeAuthenticateRequest(DeAuthenticateRequest),
9 #[frame(id = 0x01)]
10 VerifyCertificateUnidirectionalRequest(VerifyCertificateUnidirectionalRequest<'a>),
11 #[frame(id = 0x02)]
12 VerifyCertificateBidirectionalRequest(VerifyCertificateBidirectionalRequest<'a>),
13 #[frame(id = 0x03)]
14 ProofOfOwnershipRequest(ProofOfOwnershipRequest<'a>),
15 #[frame(id = 0x04)]
16 TransmitCertificateRequest(TransmitCertificateRequest<'a>),
17 #[frame(id = 0x05)]
18 RequestChallengeForAuthenticationRequest(RequestChallengeForAuthenticationRequest),
19 #[frame(id = 0x06)]
20 VerifyProofOfOwnershipUnidirectionalRequest(VerifyProofOfOwnershipUnidirectionalRequest<'a>),
21 #[frame(id = 0x07)]
22 VerifyProofOfOwnershipBidirectionalRequest(VerifyProofOfOwnershipBidirectionalRequest<'a>),
23 #[frame(id = 0x08)]
24 AuthenticationConfigurationRequest(AuthenticationConfigurationRequest),
25 #[frame(id_pat = "0x09..=0x7F")]
26 IsoSaeReserved(u8),
27}
28
29#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, FrameCodec)]
30#[frame(error = UdsError)]
31pub struct DeAuthenticateRequest {}
32
33#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, FrameCodec)]
34#[frame(error = UdsError)]
35pub struct VerifyCertificateUnidirectionalRequest<'a> {
36 pub communication_configuration: u8,
37 pub length_of_certificate_client: u16,
38 #[frame(length = "length_of_certificate_client as usize")]
39 pub certificate_client: &'a [u8],
40 pub length_of_challenge_client: u16,
41 #[frame(length = "length_of_challenge_client as usize")]
42 pub challenge_client: &'a [u8],
43}
44
45#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, FrameCodec)]
46#[frame(error = UdsError)]
47pub struct VerifyCertificateBidirectionalRequest<'a> {
48 pub communication_configuration: u8,
49 pub length_of_certificate_client: u16,
50 #[frame(length = "length_of_certificate_client as usize")]
51 pub certificate_client: &'a [u8],
52 pub length_of_challenge_client: u16,
53 #[frame(length = "length_of_challenge_client as usize")]
54 pub challenge_client: &'a [u8],
55}
56
57#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, FrameCodec)]
58#[frame(error = UdsError)]
59pub struct ProofOfOwnershipRequest<'a> {
60 pub length_of_proof_of_ownership_client: u16,
61 #[frame(length = "length_of_proof_of_ownership_client as usize")]
62 pub proof_of_ownership_client: &'a [u8],
63 pub length_of_ephemeral_public_key_client: u16,
64 #[frame(length = "length_of_ephemeral_public_key_client as usize")]
65 pub ephemeral_public_key_client: &'a [u8],
66}
67
68#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, FrameCodec)]
69#[frame(error = UdsError)]
70pub struct TransmitCertificateRequest<'a> {
71 pub certificate_evaluation_id: u16,
72 pub length_of_certificate_data: u16,
73 #[frame(length = "length_of_certificate_data as usize")]
74 pub certificate_data: &'a [u8],
75}
76
77#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, FrameCodec)]
78#[frame(error = UdsError)]
79pub struct RequestChallengeForAuthenticationRequest {
80 pub communication_configuration: u8,
81 pub algorithm_indicator: [u8; 16],
82}
83
84#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, FrameCodec)]
85#[frame(error = UdsError)]
86pub struct VerifyProofOfOwnershipUnidirectionalRequest<'a> {
87 pub algorithm_indicator: [u8; 16],
88 pub length_of_proof_of_ownership_client: u16,
89 #[frame(length = "length_of_proof_of_ownership_client as usize")]
90 pub proof_of_ownership_client: &'a [u8],
91 pub length_of_challenge_client: u16,
92 #[frame(length = "length_of_challenge_client as usize")]
93 pub challenge_client: &'a [u8],
94 pub length_of_additional_parameter: u16,
95 #[frame(length = "length_of_additional_parameter as usize")]
96 pub additional_parameter: &'a [u8],
97}
98
99#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, FrameCodec)]
100#[frame(error = UdsError)]
101pub struct VerifyProofOfOwnershipBidirectionalRequest<'a> {
102 pub algorithm_indicator: [u8; 16],
103 pub length_of_proof_of_ownership_client: u16,
104 #[frame(length = "length_of_proof_of_ownership_client as usize")]
105 pub proof_of_ownership_client: &'a [u8],
106 pub length_of_challenge_client: u16,
107 #[frame(length = "length_of_challenge_client as usize")]
108 pub challenge_client: &'a [u8],
109 pub length_of_additional_parameter: u16,
110 #[frame(length = "length_of_additional_parameter as usize")]
111 pub additional_parameter: &'a [u8],
112}
113
114#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, FrameCodec)]
115#[frame(error = UdsError)]
116pub struct AuthenticationConfigurationRequest {}