-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Currently, if I want to compare parsed OIDs against expected constants, the best I can do with the current API is the following:
const OID_RSA_ENCRYPTION: &str = "1.2.840.113549.1.1.1";
const OID_EC_PUBLIC_KEY: &str = "1.2.840.10045.2.1";
fn foo(oid: Oid) {
match oid.to_string().as_str() {
OID_RSA_ENCRYPTION => { .. },
OID_EC_PUBLIC_KEY => { .. },
}
}If Oid::from was a const fn, then we could define the constants using something like:
const OID_RSA_ENCRYPTION: Oid = Oid::from(&[1, 2, 840, 113549, 1, 1, 1]);
const OID_EC_PUBLIC_KEY: Oid = Oid::from(&[1, 2, 840, 10045, 2, 1]);
fn foo(oid: Oid) {
match oid {
OID_RSA_ENCRYPTION => { .. },
OID_EC_PUBLIC_KEY => { .. },
}
}This probably requires rusticata/der-parser#17.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels