Skip to main content

PrivLen

Enum PrivLen 

Source
pub enum PrivLen {
    Canonical,
    Jcop1Byte,
}
Expand description

Encoding length for the GP Privileges field (GPCS v2.3.1 §11.1.2, Tables 11-7..11-9). The field may legally be 1 byte (legacy / pre-2.2) or 3 bytes (the 2.2+ extended encoding); byte 1 carries the core privileges (Security Domain 0x80, Card Lock, Card Terminate, …) and bytes 2–3 carry the 2.2+ extended privileges (Trusted Path 0x80 in byte 2, …).

When an extended (byte 2/3) bit is actually set, the 3-byte form is mandatory and this selector is ignored. When bytes 2–3 are zero, the two forms are value-equivalent per the spec, but real implementations differ:

  • Canonical (3-byte) is the spec-canonical form and the safe default. The Oracle JCDK simulator requires it: given only the 1-byte form it does not treat bytes 2–3 as zero and ends up reporting an unintended privilege (e.g. Trusted Path) for the created SD.
  • Jcop1Byte collapses to 1 byte. NXP JCOP 4 P71 / J3R150 requires this: it rejects Lp = 03 for a privilege that fits in byte 1 and accepts only Lp = 01 (e.g. 01 80 for an SSD).

Selection is a per-card property; discovery sets it, the workflow passes it through. Default to Canonical unless a JCOP-P71 quirk is detected.

Variants§

§

Canonical

Always emit the full 3-byte Privileges field (spec-canonical; jcsim).

§

Jcop1Byte

Collapse to the 1-byte form when bytes 2–3 are zero (NXP JCOP 4 P71).

Trait Implementations§

Source§

impl Clone for PrivLen

Source§

fn clone(&self) -> PrivLen

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for PrivLen

Source§

impl Debug for PrivLen

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PrivLen

Source§

fn default() -> PrivLen

Returns the “default value” for a type. Read more
Source§

impl Eq for PrivLen

Source§

impl PartialEq for PrivLen

Source§

fn eq(&self, other: &PrivLen) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PrivLen

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.