Skip to main content

ScllError

Enum ScllError 

Source
#[non_exhaustive]
pub enum ScllError {
Show 38 variants TransportUnavailable, CardRemoved, ReaderGone, Timeout, ScpProtocolUnsupported, NoCommonSecurityLevel, KvnMismatch, CardCryptogramFail, CardChallengeFail, ExternalAuthFail { sw: u16, }, SecurityStatusNotSatisfied, NoOpenChannel, KeyNotFound, KeyTypeUnsupported { offered: u8, supported: Vec<u8, MAX_KEYTYPE_SUPPORTED>, }, KeyCheckValueMismatch, CannotDeleteActiveKeyset, InvalidAid { len: usize, }, AidAlreadyExists, PackageAidExists, PackageNotFound, ResidentSdNotFound, LoadTooLarge, SsdHasApplets, ElfHasOtherInstances, CardNotUsable, IllegalLifecycleTransition, ConditionsNotSatisfied, IsdAidNotFound, SessionNotIsd, TargetNoLongerExists, TerminateOutOfScope, ParentLacksAm, UnsupportedPrivilege, Card { sw: u16, }, MalformedResponse(TlvError), Build(BuildError), Cap(CapError), Backend(BackendError),
}
Expand description

Fatal error returned by every public workflow function (Result<XReport, ScllError>).

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

TransportUnavailable

§

CardRemoved

§

ReaderGone

§

Timeout

§

ScpProtocolUnsupported

§

NoCommonSecurityLevel

§

KvnMismatch

§

CardCryptogramFail

§

CardChallengeFail

§

ExternalAuthFail

Fields

§sw: u16
§

SecurityStatusNotSatisfied

§

NoOpenChannel

§

KeyNotFound

§

KeyTypeUnsupported

Fields

§offered: u8
§supported: Vec<u8, MAX_KEYTYPE_SUPPORTED>
§

KeyCheckValueMismatch

§

CannotDeleteActiveKeyset

§

InvalidAid

Fields

§len: usize
§

AidAlreadyExists

§

PackageAidExists

§

PackageNotFound

§

ResidentSdNotFound

§

LoadTooLarge

§

SsdHasApplets

§

ElfHasOtherInstances

§

CardNotUsable

§

IllegalLifecycleTransition

§

ConditionsNotSatisfied

§

IsdAidNotFound

§

SessionNotIsd

§

TargetNoLongerExists

§

TerminateOutOfScope

§

ParentLacksAm

§

UnsupportedPrivilege

§

Card

Fields

§sw: u16
§

MalformedResponse(TlvError)

§

Build(BuildError)

§

Cap(CapError)

§

Backend(BackendError)

Implementations§

Source§

impl ScllError

Source

pub fn from_general_sw(sw: u16) -> ScllError

Map a context-free command status word to its ScllError.

This covers only the general error conditions of GPCS v2.3.1 Table 11-10 — the two status words whose meaning is invariant across every GP command (6982 security status, 6985 conditions of use). Everything else falls through to the ScllError::Card catch-all, so the mapping is total: every u16 yields exactly one variant.

Per-command refinements are deliberately not decided here. The same SW means different things per command — e.g. 6985 is IllegalLifecycleTransition for SET STATUS (Table 11-87) but ElfHasOtherInstances for DELETE (Table 11-26); 6A88 is IsdAidNotFound, KeyNotFound, or PackageNotFound by context. Those live in the workflow layer, which inspects the SW before delegating the residue to this general mapper (PDD §8 status-word coverage).

Note: 9000 (success) is not an error; callers check for success before calling this. Passing it returns Card { sw: 0x9000 } (harmless).

Trait Implementations§

Source§

impl Debug for ScllError

Source§

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

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

impl Display for ScllError

Source§

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

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

impl Error for ScllError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<BackendError> for ScllError

Source§

fn from(source: BackendError) -> Self

Converts to this type from the input type.
Source§

impl From<BuildError> for ScllError

Source§

fn from(source: BuildError) -> Self

Converts to this type from the input type.
Source§

impl From<CapError> for ScllError

Source§

fn from(source: CapError) -> Self

Converts to this type from the input type.
Source§

impl From<TlvError> for ScllError

Source§

fn from(source: TlvError) -> Self

Converts to this type from the input type.

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> 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.