Remove unneeded constants

This commit is contained in:
Sosthène Guédon
2023-04-06 10:36:24 +02:00
parent 790a7a8c1b
commit 1c0dc83b7f
-99
View File
@@ -33,105 +33,6 @@ pub const DERIVED_PIV_AID: [u8; 11] = hex!("A000000308 00002000 0100");
pub const APPLICATION_LABEL: &[u8] = b"SoloKeys PIV";
pub const APPLICATION_URL: &[u8] = b"https://github.com/solokeys/piv-authenticator";
// pub const APPLICATION_URL: &[u8] = b"https://piv.is/SoloKeys/PIV/1.0.0-alpha1";
// https://git.io/JfWuD
pub const YUBICO_OTP_PIX: [u8; 3] = hex!("200101");
pub const YUBICO_OTP_AID: iso7816::Aid = iso7816::Aid::new(&hex!("A000000527 200101"));
// they use it to "deauthenticate user PIN and mgmt key": https://git.io/JfWgN
pub const YUBICO_MGMT_PIX: [u8; 3] = hex!("471117");
pub const YUBICO_MGMT_AID: [u8; 8] = hex!("A000000527 471117");
// https://git.io/JfW28
// const (
// // https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-78-4.pdf#page=17
// algTag = 0x80
// alg3DES = 0x03
// algRSA1024 = 0x06
// algRSA2048 = 0x07
// algECCP256 = 0x11
// algECCP384 = 0x14
// // https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-78-4.pdf#page=16
// keyAuthentication = 0x9a
// keyCardManagement = 0x9b
// keySignature = 0x9c
// keyKeyManagement = 0x9d
// keyCardAuthentication = 0x9e
// keyAttestation = 0xf9
// insVerify = 0x20
// insChangeReference = 0x24
// insResetRetry = 0x2c
// insGenerateAsymmetric = 0x47
// insAuthenticate = 0x87
// insGetData = 0xcb
// insPutData = 0xdb
// insSelectApplication = 0xa4
// insGetResponseAPDU = 0xc0
// // https://github.com/Yubico/yubico-piv-tool/blob/yubico-piv-tool-1.7.0/lib/ykpiv.h#L656
// insGetSerial = 0xf8
// insAttest = 0xf9
// insSetPINRetries = 0xfa
// insReset = 0xfb
// insGetVersion = 0xfd
// insImportKey = 0xfe
// insSetMGMKey = 0xff
// )
pub const OK: &[u8; 2] = &[0x90, 0x00];
// pub const SELECT: (u8, u8, u8, u8, usize) = (
pub const SELECT: (u8, u8, u8, u8) = (
0x00, // interindustry, channel 0, no chain, no secure messaging,
0xa4, // SELECT
// p1
0x04, // data is DF name, may be AID, possibly right-truncated
// p2: i think this is dummy here
0x00, // b2, b1 zero means "file occurence": first/only occurence,
// b4, b3 zero means "file control information": return FCI template
// 256,
);
//
// See SP 800-73 Part 1, Table 7
// for list of all objects and minimum container capacity
// - CCC: 287
// - CHUID: 2916
// - discovery: 19
// - key history: 256
// - x5c: 1905B
// - etc.
//
// pub const GET_DATA: (u8, u8, u8, u8, usize) = (
pub const GET_DATA: (u8, u8, u8, u8) = (
0x00, // as before, would be 0x0C for secure messaging
0xCB, // GET DATA. There's also `CA`, setting bit 1 here
// means (7816-4, sec. 5.1.2): use BER-TLV, as opposed
// to "no indication provided".
// P1, P2: 7816-4, sec. 7.4.1: bit 1 of INS set => P1,P2 identifies
// a file. And 0x3FFF identifies current DF
0x3F, 0xFF,
// 256,
);
// #[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct DataObjects {}
#[allow(non_upper_case_globals)]
impl DataObjects {
pub const DiscoveryObject: &'static [u8] = &[0x7e];
pub const BiometricInformationTemplate: &'static [u8] = &[0x7f, 0x61];
pub const X509CertificateForCardAuthentication: &'static [u8] = &[0x5f, 0xc1, 0x01];
// CHUID, contains GUID
pub const CardHolderUniqueIdentifier: &'static [u8] = &[0x5f, 0xc1, 0x02];
pub const X509CertificateForPivAuthentication: &'static [u8] = &[0x5f, 0xc1, 0x05];
pub const X509CertificateForDigitalSignature: &'static [u8] = &[0x5f, 0xc1, 0x0a];
pub const X509CertificateForKeyManagement: &'static [u8] = &[0x5f, 0xc1, 0x0b];
pub const KeyHistoryObject: &'static [u8] = &[0x5f, 0xc1, 0x0c];
}
pub const YUBICO_DEFAULT_MANAGEMENT_KEY: &[u8; 24] = &hex!(
"