[u8; N] arrays should be allowed as OCTET STRING fields.
#[derive(Sequence)]
pub struct MySequence {
#[asn1(context_specific = "2", type = "OCTET STRING")]
pub authority_reference: [u8; 8],
}
error[E0277]: the trait bound `der::asn1::OctetStringRef<'_>: TryFrom<[u8; 8]>` is not satisfied
--> example.rs:68:10
|
68 | #[derive(Sequence)]
| ^^^^^^^^ the trait `From<[u8; 8]>` is not implemented for `der::asn1::OctetStringRef<'_>`
|
= help: the following other types implement trait `From<T>`:
`der::asn1::OctetStringRef<'_>` implements `From<&der::asn1::OctetString>`
`der::asn1::OctetStringRef<'_>` implements `From<&der::asn1::OctetStringRef<'_>>`
= note: required for `[u8; 8]` to implement `Into<der::asn1::OctetStringRef<'_>>`
= note: required for `der::asn1::OctetStringRef<'_>` to implement `TryFrom<[u8; 8]>`
= note: this error originates in the derive macro `Sequence`
does not work with deref ="true" too.
the trait `From<&[u8; 8]>` is not implemented for `OctetStringRef<'_>`
[Spoiler] real use case
/// EU Tachograph certificate body
#[derive(Sequence, Debug, Clone)]
#[asn1(tag_mode = "IMPLICIT")]
pub struct TachographCertificateBodyRaw {
/// primitive, 1 byte
#[asn1(application = "41", type = "OCTET STRING")]
pub profile_identifier: [u8; 1],
/// primitive, 8 bytes
#[asn1(application = "2", type = "OCTET STRING")]
pub authority_reference: [u8; 8],
/// primitive, 7 bytes
#[asn1(application = "76", type = "OCTET STRING")]
pub holder_authorisation: [u8; 7],
/// constructed
#[asn1(application = "73")]
pub public_key: CertificatePublicKeyRaw,
/// primitive, 8 bytes
#[asn1(application = "32", type = "OCTET STRING")]
pub holder_reference: [u8; 8],
/// primitive, 4 bytes
#[asn1(application = "37", type = "OCTET STRING")]
pub effective_date: [u8; 4],
/// primitive, 4 bytes
#[asn1(application = "36", type = "OCTET STRING")]
pub expiration_date: [u8; 4],
}
[u8; N]arrays should be allowed asOCTET STRINGfields.does not work with
deref ="true"too.[Spoiler] real use case