TianoCore EDK2 master
Loading...
Searching...
No Matches
SmartCardEdge.h File Reference

Go to the source code of this file.

Data Structures

struct  _EFI_SMART_CARD_EDGE_PROTOCOL
 

Macros

#define EFI_SMART_CARD_EDGE_PROTOCOL_GUID
 
#define SCARD_AID_MAXSIZE   0x0010
 
#define SCARD_CSN_SIZE   0x0010
 
#define SMART_CARD_EDGE_PROTOCOL_VERSION_1   0x00000100
 
#define SC_EDGE_TAG_HEADER   0x0000
 
#define SC_EDGE_TAG_CERT   0x0001
 
#define SC_EDGE_TAG_KEY_ID   0x0002
 
#define SC_EDGE_TAG_KEY_TYPE   0x0003
 
#define SC_EDGE_TAG_KEY_SIZE   0x0004
 
#define SC_EDGE_L_SIZE_HEADER   1
 
#define SC_EDGE_L_SIZE_CERT   2
 
#define SC_EDGE_L_SIZE_KEY_ID   1
 
#define SC_EDGE_L_SIZE_KEY_TYPE   1
 
#define SC_EDGE_L_SIZE_KEY_SIZE   2
 
#define SC_EDGE_L_VALUE_HEADER   1
 
#define SC_EDGE_L_VALUE_KEY_ID   1
 
#define SC_EDGE_L_VALUE_KEY_TYPE   1
 
#define SC_EDGE_L_VALUE_KEY_SIZE   2
 
#define SC_EDGE_RSA_EXCHANGE   0x01
 
#define SC_EDGE_RSA_SIGNATURE   0x02
 
#define SC_EDGE_ECDSA_256   0x03
 
#define SC_EDGE_ECDSA_384   0x04
 
#define SC_EDGE_ECDSA_521   0x05
 
#define SC_EDGE_ECDH_256   0x06
 
#define SC_EDGE_ECDH_384   0x07
 
#define SC_EDGE_ECDH_521   0x08
 
#define EFI_PADDING_RSASSA_PKCS1V1P5_GUID
 
#define EFI_PADDING_RSASSA_PSS_GUID
 
#define EFI_PADDING_NONE_GUID
 
#define EFI_PADDING_RSAES_PKCS1V1P5_GUID
 
#define EFI_PADDING_RSAES_OAEP_GUID
 

Typedefs

typedef struct _EFI_SMART_CARD_EDGE_PROTOCOL EFI_SMART_CARD_EDGE_PROTOCOL
 
typedef UINT8 SMART_CARD_AID[SCARD_AID_MAXSIZE]
 
typedef UINT8 SMART_CARD_CSN[SCARD_CSN_SIZE]
 
typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_GET_CONTEXT) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, OUT UINTN *NumberAidSupported, IN OUT UINTN *AidTableSize OPTIONAL, OUT SMART_CARD_AID *AidTable OPTIONAL, OUT UINTN *NumberSCPresent, IN OUT UINTN *CsnTableSize OPTIONAL, OUT SMART_CARD_CSN *CsnTable OPTIONAL, OUT UINT32 *VersionScEdgeProtocol OPTIONAL)
 
typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_CONNECT) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, OUT EFI_HANDLE *SCardHandle, IN UINT8 *ScardCsn OPTIONAL, OUT UINT8 *ScardAid OPTIONAL)
 
typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_DISCONNECT) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle)
 
typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_GET_CSN) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, OUT UINT8 Csn[SCARD_CSN_SIZE])
 
typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_GET_READER_NAME) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN OUT UINTN *ReaderNameLength, OUT CHAR16 *ReaderName OPTIONAL)
 
typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_VERIFY_PIN) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN INT32 PinSize, IN UINT8 *PinCode, OUT BOOLEAN *PinResult, OUT UINT32 *RemainingAttempts OPTIONAL)
 
typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_GET_PIN_REMAINING) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, OUT UINT32 *RemainingAttempts)
 
typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_GET_DATA) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN EFI_GUID *DataId, IN OUT UINTN *DataSize, OUT VOID *Data OPTIONAL)
 
typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_GET_CREDENTIAL) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN OUT UINTN *CredentialSize, OUT UINT8 *CredentialList OPTIONAL)
 
typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_SIGN_DATA) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN UINTN KeyId, IN UINTN KeyType, IN EFI_GUID *HashAlgorithm, IN EFI_GUID *PaddingMethod, IN UINT8 *HashedData, OUT UINT8 *SignatureData)
 
typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_DECRYPT_DATA) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN UINTN KeyId, IN EFI_GUID *HashAlgorithm, IN EFI_GUID *PaddingMethod, IN UINTN EncryptedSize, IN UINT8 *EncryptedData, IN OUT UINTN *PlaintextSize, OUT UINT8 *PlaintextData)
 
typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_BUILD_DH_AGREEMENT) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN UINTN KeyId, IN UINT8 *dataQx, IN UINT8 *dataQy, OUT UINT8 *DHAgreement)
 

Variables

EFI_GUID gEfiPaddingRsassaPkcs1V1P5Guid
 
EFI_GUID gEfiPaddingRsassaPssGuid
 
EFI_GUID gEfiPaddingNoneGuid
 
EFI_GUID gEfiPaddingRsaesPkcs1V1P5Guid
 
EFI_GUID gEfiPaddingRsaesOaepGuid
 
EFI_GUID gEfiSmartCardEdgeProtocolGuid
 

Detailed Description

The Smart Card Edge Protocol provides an abstraction for device to provide Smart Card support.

This protocol allows UEFI applications to interface with a Smart Card during boot process for authentication or data signing/decryption, especially if the application has to make use of PKI.

Copyright (c) 2015-2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Revision Reference:
This Protocol was introduced in UEFI Specification 2.5.

Definition in file SmartCardEdge.h.

Macro Definition Documentation

◆ EFI_PADDING_NONE_GUID

#define EFI_PADDING_NONE_GUID
Value:
{ \
0x3629ddb1, 0x228c, 0x452e, {0xb6, 0x16, 0x09, 0xed, 0x31, 0x6a, 0x97, 0x00} \
}

Definition at line 176 of file SmartCardEdge.h.

◆ EFI_PADDING_RSAES_OAEP_GUID

#define EFI_PADDING_RSAES_OAEP_GUID
Value:
{ \
0xc1e63ac4, 0xd0cf, 0x4ce6, {0x83, 0x5b, 0xee, 0xd0, 0xe6, 0xa8, 0xa4, 0x5b} \
}

Definition at line 196 of file SmartCardEdge.h.

◆ EFI_PADDING_RSAES_PKCS1V1P5_GUID

#define EFI_PADDING_RSAES_PKCS1V1P5_GUID
Value:
{ \
0xe1c1d0a9, 0x40b1, 0x4632, {0xbd, 0xcc, 0xd9, 0xd6, 0xe5, 0x29, 0x56, 0x31} \
}

Definition at line 186 of file SmartCardEdge.h.

◆ EFI_PADDING_RSASSA_PKCS1V1P5_GUID

#define EFI_PADDING_RSASSA_PKCS1V1P5_GUID
Value:
{ \
0x9317ec24, 0x7cb0, 0x4d0e, {0x8b, 0x32, 0x2e, 0xd9, 0x20, 0x9c, 0xd8, 0xaf} \
}

Definition at line 153 of file SmartCardEdge.h.

◆ EFI_PADDING_RSASSA_PSS_GUID

#define EFI_PADDING_RSASSA_PSS_GUID
Value:
{ \
0x7b2349e0, 0x522d, 0x4f8e, {0xb9, 0x27, 0x69, 0xd9, 0x7c, 0x9e, 0x79, 0x5f} \
}

Definition at line 163 of file SmartCardEdge.h.

◆ EFI_SMART_CARD_EDGE_PROTOCOL_GUID

#define EFI_SMART_CARD_EDGE_PROTOCOL_GUID
Value:
{ \
0xd317f29b, 0xa325, 0x4712, {0x9b, 0xf1, 0xc6, 0x19, 0x54, 0xdc, 0x19, 0x8c} \
}

Definition at line 20 of file SmartCardEdge.h.

◆ SC_EDGE_ECDH_256

#define SC_EDGE_ECDH_256   0x06

Definition at line 137 of file SmartCardEdge.h.

◆ SC_EDGE_ECDH_384

#define SC_EDGE_ECDH_384   0x07

Definition at line 141 of file SmartCardEdge.h.

◆ SC_EDGE_ECDH_521

#define SC_EDGE_ECDH_521   0x08

Definition at line 145 of file SmartCardEdge.h.

◆ SC_EDGE_ECDSA_256

#define SC_EDGE_ECDSA_256   0x03

Definition at line 125 of file SmartCardEdge.h.

◆ SC_EDGE_ECDSA_384

#define SC_EDGE_ECDSA_384   0x04

Definition at line 129 of file SmartCardEdge.h.

◆ SC_EDGE_ECDSA_521

#define SC_EDGE_ECDSA_521   0x05

Definition at line 133 of file SmartCardEdge.h.

◆ SC_EDGE_L_SIZE_CERT

#define SC_EDGE_L_SIZE_CERT   2

Definition at line 78 of file SmartCardEdge.h.

◆ SC_EDGE_L_SIZE_HEADER

#define SC_EDGE_L_SIZE_HEADER   1

Definition at line 74 of file SmartCardEdge.h.

◆ SC_EDGE_L_SIZE_KEY_ID

#define SC_EDGE_L_SIZE_KEY_ID   1

Definition at line 82 of file SmartCardEdge.h.

◆ SC_EDGE_L_SIZE_KEY_SIZE

#define SC_EDGE_L_SIZE_KEY_SIZE   2

Definition at line 90 of file SmartCardEdge.h.

◆ SC_EDGE_L_SIZE_KEY_TYPE

#define SC_EDGE_L_SIZE_KEY_TYPE   1

Definition at line 86 of file SmartCardEdge.h.

◆ SC_EDGE_L_VALUE_HEADER

#define SC_EDGE_L_VALUE_HEADER   1

Definition at line 97 of file SmartCardEdge.h.

◆ SC_EDGE_L_VALUE_KEY_ID

#define SC_EDGE_L_VALUE_KEY_ID   1

Definition at line 101 of file SmartCardEdge.h.

◆ SC_EDGE_L_VALUE_KEY_SIZE

#define SC_EDGE_L_VALUE_KEY_SIZE   2

Definition at line 109 of file SmartCardEdge.h.

◆ SC_EDGE_L_VALUE_KEY_TYPE

#define SC_EDGE_L_VALUE_KEY_TYPE   1

Definition at line 105 of file SmartCardEdge.h.

◆ SC_EDGE_RSA_EXCHANGE

#define SC_EDGE_RSA_EXCHANGE   0x01

Definition at line 117 of file SmartCardEdge.h.

◆ SC_EDGE_RSA_SIGNATURE

#define SC_EDGE_RSA_SIGNATURE   0x02

Definition at line 121 of file SmartCardEdge.h.

◆ SC_EDGE_TAG_CERT

#define SC_EDGE_TAG_CERT   0x0001

Definition at line 54 of file SmartCardEdge.h.

◆ SC_EDGE_TAG_HEADER

#define SC_EDGE_TAG_HEADER   0x0000

Definition at line 50 of file SmartCardEdge.h.

◆ SC_EDGE_TAG_KEY_ID

#define SC_EDGE_TAG_KEY_ID   0x0002

Definition at line 58 of file SmartCardEdge.h.

◆ SC_EDGE_TAG_KEY_SIZE

#define SC_EDGE_TAG_KEY_SIZE   0x0004

Definition at line 66 of file SmartCardEdge.h.

◆ SC_EDGE_TAG_KEY_TYPE

#define SC_EDGE_TAG_KEY_TYPE   0x0003

Definition at line 62 of file SmartCardEdge.h.

◆ SCARD_AID_MAXSIZE

#define SCARD_AID_MAXSIZE   0x0010

Definition at line 30 of file SmartCardEdge.h.

◆ SCARD_CSN_SIZE

#define SCARD_CSN_SIZE   0x0010

Definition at line 34 of file SmartCardEdge.h.

◆ SMART_CARD_EDGE_PROTOCOL_VERSION_1

#define SMART_CARD_EDGE_PROTOCOL_VERSION_1   0x00000100

Definition at line 38 of file SmartCardEdge.h.

Typedef Documentation

◆ EFI_SMART_CARD_EDGE_BUILD_DH_AGREEMENT

typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_BUILD_DH_AGREEMENT) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN UINTN KeyId, IN UINT8 *dataQx, IN UINT8 *dataQy, OUT UINT8 *DHAgreement)

This function performs a secret Diffie Hellman agreement calculation that would be used to derive a symmetric encryption / decryption key.

The function compute a DH agreement that should be diversified togenerate a symmetric key to proceed encryption or decryption.

The application and the Smart Card shall agree on the diversification process.

The KeyId must reference a key of one of the types: SC_EDGE_ECDH_256, SC_EDGE_ECDH_384 or SC_EDGE_ECDH_521.

Parameters
[in]ThisIndicates a pointer to the calling context.
[in]SCardHandleHandle on Smart Card connection.
[in]KeyIdIdentifier of the key container, retrieved in a key index item of credentials.
[in]dataQxPublic key x coordinate. Size is the same as key size for KeyId. Stored in big endian format.
[in]dataQyPublic key y coordinate. Size is the same as key size for KeyId. Stored in big endian format.
[out]DHAgreementBuffer for DH agreement computed. Size must be bigger or equal to key size for KeyId.
Return values
EFI_SUCCESSThe requested command completed successfully.
EFI_INVALID_PARAMETERThis is NULL.
EFI_INVALID_PARAMETERNo connection for SCardHandle value.
EFI_INVALID_PARAMETERKeyId is not valid.
EFI_INVALID_PARAMETERdataQx is NULL.
EFI_INVALID_PARAMETERdataQy is NULL.
EFI_INVALID_PARAMETERDHAgreement is NULL.
EFI_ACCESS_DENIEDOperation not performed, conditions not fulfilled. PIN not verified.
EFI_NO_MEDIASmart Card or Reader of SCardHandle connection has been removed. A Disconnect should be performed.

Definition at line 704 of file SmartCardEdge.h.

◆ EFI_SMART_CARD_EDGE_CONNECT

typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_CONNECT) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, OUT EFI_HANDLE *SCardHandle, IN UINT8 *ScardCsn OPTIONAL, OUT UINT8 *ScardAid OPTIONAL)

This function establish a connection with a Smart Card the protocol support.

In case of success the SCardHandle can be used.

If the ScardCsn is NULL the connection is established with the first Smart Card the protocol finds in its table of Smart Card present and supported. Else it establish context with the Smart Card whose CSN given by ScardCsn.

If ScardAid is not NULL the function returns the Smart Card AID the protocol supports. After a successful connect the SCardHandle will remain existing even in case Smart Card removed from Smart Card reader, but all function invoking this SCardHandle will fail. SCardHandle is released only on Disconnect.

Parameters
[in]ThisIndicates a pointer to the calling context.
[out]SCardHandleHandle on Smart Card connection.
[in]ScardCsnCSN of the Smart Card the connection has to be established.
[out]ScardAidAID of the Smart Card the connection has been established.
Return values
EFI_SUCCESSThe requested command completed successfully.
EFI_INVALID_PARAMETERThis is NULL.
EFI_INVALID_PARAMETERSCardHandle is NULL.
EFI_NO_MEDIANo Smart Card supported by protocol is present, Smart Card with CSN ScardCsn or Reader has been removed. A Disconnect should be performed.

Definition at line 289 of file SmartCardEdge.h.

◆ EFI_SMART_CARD_EDGE_DECRYPT_DATA

typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_DECRYPT_DATA) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN UINTN KeyId, IN EFI_GUID *HashAlgorithm, IN EFI_GUID *PaddingMethod, IN UINTN EncryptedSize, IN UINT8 *EncryptedData, IN OUT UINTN *PlaintextSize, OUT UINT8 *PlaintextData)

This function decrypts data with a PKI/RSA Smart Card private key.

The function decrypts some PKI/RSA encrypted data with private key securely stored into the Smart Card.

The KeyId must reference a key of type SC_EDGE_RSA_EXCHANGE.

Parameters
[in]ThisIndicates a pointer to the calling context.
[in]SCardHandleHandle on Smart Card connection.
[in]KeyIdIdentifier of the key container, retrieved in a key index item of credentials.
[in]HashAlgorithmHash algorithm used to hash the, one of:
  • EFI_HASH_ALGORITHM_SHA1_GUID
  • EFI_HASH_ALGORITHM_SHA256_GUID
  • EFI_HASH_ALGORITHM_SHA384_GUID
  • EFI_HASH_ALGORITHM_SHA512_GUID
[in]PaddingMethodPadding method used jointly with hash algorithm, one of:
  • EFI_PADDING_NONE_GUID
  • EFI_PADDING_RSAES_PKCS1V1P5_GUID
  • EFI_PADDING_RSAES_OAEP_GUID
[in]EncryptedSizeSize of data to decrypt.
[in]EncryptedDataData to decrypt
[in,out]PlaintextSizeOn input, in bytes, the size of buffer to store the decrypted data. On output, in bytes, the size of buffer required to store the decrypted data.
[out]PlaintextDataBuffer for decrypted data, padding removed.
Return values
EFI_SUCCESSThe requested command completed successfully.
EFI_INVALID_PARAMETERThis is NULL.
EFI_INVALID_PARAMETERNo connection for SCardHandle value.
EFI_INVALID_PARAMETERKeyId is not valid or associated key not of type SC_EDGE_RSA_EXCHANGE.
EFI_INVALID_PARAMETERHashAlgorithm is NULL.
EFI_INVALID_PARAMETERHashAlgorithm is not valid.
EFI_INVALID_PARAMETERPaddingMethod is NULL.
EFI_INVALID_PARAMETERPaddingMethod is not valid.
EFI_INVALID_PARAMETEREncryptedSize is 0.
EFI_INVALID_PARAMETEREncryptedData is NULL.
EFI_INVALID_PARAMETERPlaintextSize is NULL.
EFI_INVALID_PARAMETERPlaintextData is NULL.
EFI_ACCESS_DENIEDOperation not performed, conditions not fulfilled. PIN not verified.
EFI_BUFFER_TOO_SMALLPlaintextSize is too small for the plaintext data and the required size is returned in PlaintextSize.
EFI_NO_MEDIASmart Card or Reader of SCardHandle connection has been removed. A Disconnect should be performed.

Definition at line 654 of file SmartCardEdge.h.

◆ EFI_SMART_CARD_EDGE_DISCONNECT

typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_DISCONNECT) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle)

This function releases a connection previously established by Connect.

The Disconnect function releases the connection previously established by a Connect. In case the Smart Card or the Smart Card reader has been removed before this call, this function returns EFI_SUCCESS.

Parameters
[in]ThisIndicates a pointer to the calling context.
[in]SCardHandleHandle on Smart Card connection to release.
Return values
EFI_SUCCESSThe requested command completed successfully.
EFI_INVALID_PARAMETERThis is NULL.
EFI_INVALID_PARAMETERNo connection for SCardHandle value.

Definition at line 313 of file SmartCardEdge.h.

◆ EFI_SMART_CARD_EDGE_GET_CONTEXT

typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_GET_CONTEXT) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, OUT UINTN *NumberAidSupported, IN OUT UINTN *AidTableSize OPTIONAL, OUT SMART_CARD_AID *AidTable OPTIONAL, OUT UINTN *NumberSCPresent, IN OUT UINTN *CsnTableSize OPTIONAL, OUT SMART_CARD_CSN *CsnTable OPTIONAL, OUT UINT32 *VersionScEdgeProtocol OPTIONAL)

This function retrieves the context driver.

The GetContextfunction returns the context of the protocol, the application identifiers supported by the protocol and the number and the CSN unique identifier of Smart Cards that are present and supported by protocol.

If AidTableSize, AidTable, CsnTableSize, CsnTable or VersionProtocol is NULL, the function does not fail but does not fill in such variables.

In case AidTableSize indicates a buffer too small to hold all the protocol AID table, only the first AidTableSize items of the table are returned in AidTable.

In case CsnTableSize indicates a buffer too small to hold the entire table of Smart Card CSN present, only the first CsnTableSize items of the table are returned in CsnTable.

VersionScEdgeProtocol returns the version of the EFI_SMART_CARD_EDGE_PROTOCOL this driver uses. For this protocol specification value is SMART_CARD_EDGE_PROTOCOL_VERSION_1.

In case of Smart Card removal the internal CSN list is immediately updated, even if a connection is opened with that Smart Card.

Parameters
[in]ThisIndicates a pointer to the calling context.
[out]NumberAidSupportedNumber of AIDs this protocol supports.
[in,out]AidTableSizeOn input, number of items allocated for the AID table. On output, number of items returned by protocol.
[out]AidTableTable of the AIDs supported by the protocol.
[out]NumberSCPresentNumber of currently present Smart Cards that are supported by protocol.
[in,out]CsnTableSizeOn input, the number of items the buffer CSN table can contain. On output, the number of items returned by the protocol.
[out]CsnTableTable of the CSN of the Smart Card present and supported by protocol.
[out]VersionScEdgeProtocolEFI_SMART_CARD_EDGE_PROTOCOL version.
Return values
EFI_SUCCESSThe requested command completed successfully.
EFI_INVALID_PARAMETERThis is NULL.
EFI_INVALID_PARAMETERNumberSCPresent is NULL.

Definition at line 247 of file SmartCardEdge.h.

◆ EFI_SMART_CARD_EDGE_GET_CREDENTIAL

typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_GET_CREDENTIAL) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN OUT UINTN *CredentialSize, OUT UINT8 *CredentialList OPTIONAL)

This function retrieve credentials store into the Smart Card.

The function returns a series of items in TLV (Tag Length Value) format.

First TLV item is the header item that gives the number of following containers (0x00, 0x01, Nb containers).

All these containers are a series of 4 TLV items:

  • The certificate item (0x01, certificate size, certificate)
  • The Key identifier item (0x02, 0x01, key index)
  • The key type item (0x03, 0x01, key type)
  • The key size item (0x04, 0x02, key size), key size in number of bits. Numeric multi-bytes values are on big endian format, most significant byte first:
  • The L field value for certificate (2 bytes)
  • The L field value for key size (2 bytes)
  • The value field for key size (2 bytes)
Parameters
[in]ThisIndicates a pointer to the calling context.
[in]SCardHandleHandle on Smart Card connection.
[in,out]CredentialSizeOn input, in bytes, the size of buffer to store the list of credential. On output, in bytes, the size of buffer required to store the entire list of credentials.
[out]CredentialListList of credentials stored into the Smart Card. A list of TLV (Tag Length Value) elements organized in containers array.
Return values
EFI_SUCCESSThe requested command completed successfully.
EFI_INVALID_PARAMETERThis is NULL.
EFI_INVALID_PARAMETERNo connection for SCardHandle value.
EFI_INVALID_PARAMETERCredentialSize is NULL.
EFI_INVALID_PARAMETERCredentialList is NULL, if CredentialSize is not zero.
EFI_BUFFER_TOO_SMALLThe size of CredentialList is too small for the specified data and the required size is returned in CredentialSize.
EFI_NO_MEDIASmart Card or Reader of SCardHandle connection has been removed. A Disconnect should be performed.

Definition at line 532 of file SmartCardEdge.h.

◆ EFI_SMART_CARD_EDGE_GET_CSN

typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_GET_CSN) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, OUT UINT8 Csn[SCARD_CSN_SIZE])

This function returns the Smart Card serial number.

Parameters
[in]ThisIndicates a pointer to the calling context.
[in]SCardHandleHandle on Smart Card connection.
[out]CsnThe Card Serial number, 16 bytes array.
Return values
EFI_SUCCESSThe requested command completed successfully.
EFI_INVALID_PARAMETERThis is NULL.
EFI_INVALID_PARAMETERNo connection for SCardHandle value.
EFI_NO_MEDIASmart Card or Reader of SCardHandle connection has been removed. A Disconnect should be performed.

Definition at line 334 of file SmartCardEdge.h.

◆ EFI_SMART_CARD_EDGE_GET_DATA

typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_GET_DATA) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN EFI_GUID *DataId, IN OUT UINTN *DataSize, OUT VOID *Data OPTIONAL)

This function returns a specific data from Smart Card.

The function is generic for any kind of data, but driver and application must share an EFI_GUID that identify the data.

Parameters
[in]ThisIndicates a pointer to the calling context.
[in]SCardHandleHandle on Smart Card connection.
[in]DataIdThe type identifier of the data to get.
[in,out]DataSizeOn input, in bytes, the size of Data. On output, in bytes, the size of buffer required to store the specified data.
[out]DataThe data buffer in which the data is returned. The type of the data buffer is associated with the DataId. Ignored if *DataSize is 0.
Return values
EFI_SUCCESSThe requested command completed successfully.
EFI_INVALID_PARAMETERThis is NULL.
EFI_INVALID_PARAMETERNo connection for SCardHandle value.
EFI_INVALID_PARAMETERDataId is NULL.
EFI_INVALID_PARAMETERDataSize is NULL.
EFI_INVALID_PARAMETERData is NULL, and *DataSize is not zero.
EFI_NOT_FOUNDDataId unknown for this driver.
EFI_BUFFER_TOO_SMALLThe size of Data is too small for the specified data and the required size is returned in DataSize.
EFI_ACCESS_DENIEDOperation not performed, conditions not fulfilled. PIN not verified.
EFI_NO_MEDIASmart Card or Reader of SCardHandle connection has been removed. A Disconnect should be performed.

Definition at line 481 of file SmartCardEdge.h.

◆ EFI_SMART_CARD_EDGE_GET_PIN_REMAINING

typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_GET_PIN_REMAINING) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, OUT UINT32 *RemainingAttempts)

This function gives the remaining number of attempts for PIN code presentation.

The number of attempts to present a correct PIN is limited and depends on Smart Card and on PIN.

This function will retrieve the number of remaining possible attempts.

Parameters
[in]ThisIndicates a pointer to the calling context.
[in]SCardHandleHandle on Smart Card connection.
[out]RemainingAttemptsNumber of attempts still possible.
Return values
EFI_SUCCESSThe requested command completed successfully.
EFI_INVALID_PARAMETERThis is NULL.
EFI_INVALID_PARAMETERNo connection for SCardHandle value.
EFI_INVALID_PARAMETERRemainingAttempts is NULL.
EFI_NO_MEDIASmart Card or Reader of SCardHandle connection has been removed. A Disconnect should be performed.

Definition at line 442 of file SmartCardEdge.h.

◆ EFI_SMART_CARD_EDGE_GET_READER_NAME

typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_GET_READER_NAME) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN OUT UINTN *ReaderNameLength, OUT CHAR16 *ReaderName OPTIONAL)

This function returns the name of the Smart Card reader used for this connection.

Parameters
[in]ThisIndicates a pointer to the calling context.
[in]SCardHandleHandle on Smart Card connection.
[in,out]ReaderNameLengthOn input, a pointer to the variable that holds the maximal size, in bytes, of ReaderName. On output, the required size, in bytes, for ReaderName.
[out]ReaderNameA pointer to a NULL terminated string that will contain the reader name.
Return values
EFI_SUCCESSThe requested command completed successfully.
EFI_INVALID_PARAMETERThis is NULL.
EFI_INVALID_PARAMETERNo connection for SCardHandle value.
EFI_INVALID_PARAMETERReaderNameLength is NULL.
EFI_NO_MEDIASmart Card or Reader of SCardHandle connection has been removed. A Disconnect should be performed.

Definition at line 361 of file SmartCardEdge.h.

◆ EFI_SMART_CARD_EDGE_PROTOCOL

◆ EFI_SMART_CARD_EDGE_SIGN_DATA

typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_SIGN_DATA) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN UINTN KeyId, IN UINTN KeyType, IN EFI_GUID *HashAlgorithm, IN EFI_GUID *PaddingMethod, IN UINT8 *HashedData, OUT UINT8 *SignatureData)

This function signs an already hashed data with a Smart Card private key.

This function signs data, actually it is the hash of these data that is given to the function.

SignatureData buffer shall be big enough for signature. Signature size is function key size and key type.

Parameters
[in]ThisIndicates a pointer to the calling context.
[in]SCardHandleHandle on Smart Card connection.
[in]KeyIdIdentifier of the key container, retrieved in a key index item of credentials.
[in]KeyTypeThe key type, retrieved in a key type item of credentials.
[in]HashAlgorithmHash algorithm used to hash the, one of:
  • EFI_HASH_ALGORITHM_SHA1_GUID
  • EFI_HASH_ALGORITHM_SHA256_GUID
  • EFI_HASH_ALGORITHM_SHA384_GUID
  • EFI_HASH_ALGORITHM_SHA512_GUID
[in]PaddingMethodPadding method used jointly with hash algorithm, one of:
  • EFI_PADDING_RSASSA_PKCS1V1P5_GUID
  • EFI_PADDING_RSASSA_PSS_GUID
[in]HashedDataHash of the data to sign. Size is function of the HashAlgorithm.
[out]SignatureDataResulting signature with private key KeyId. Size is function of the KeyType and key size retrieved in the associated key size item of credentials.
Return values
EFI_SUCCESSThe requested command completed successfully.
EFI_INVALID_PARAMETERThis is NULL.
EFI_INVALID_PARAMETERNo connection for SCardHandle value.
EFI_INVALID_PARAMETERKeyId is not valid.
EFI_INVALID_PARAMETERKeyType is not valid or not corresponding to KeyId.
EFI_INVALID_PARAMETERHashAlgorithm is NULL.
EFI_INVALID_PARAMETERHashAlgorithm is not valid.
EFI_INVALID_PARAMETERPaddingMethod is NULL.
EFI_INVALID_PARAMETERPaddingMethod is not valid.
EFI_INVALID_PARAMETERHashedData is NULL.
EFI_INVALID_PARAMETERSignatureData is NULL.
EFI_ACCESS_DENIEDOperation not performed, conditions not fulfilled. PIN not verified.
EFI_NO_MEDIASmart Card or Reader of SCardHandle connection has been removed. A Disconnect should be performed.

Definition at line 590 of file SmartCardEdge.h.

◆ EFI_SMART_CARD_EDGE_VERIFY_PIN

typedef EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_VERIFY_PIN) (IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN INT32 PinSize, IN UINT8 *PinCode, OUT BOOLEAN *PinResult, OUT UINT32 *RemainingAttempts OPTIONAL)

This function authenticates a Smart Card user by presenting a PIN code.

The VerifyPinfunction presents a PIN code to the Smart Card.

If Smart Card found the PIN code correct the user is considered authenticated to current application, and the function returns TRUE.

Negative or null PinSize value rejected if PinCodeis not NULL.

A NULL PinCodebuffer means the application didn't know the PIN, in that case:

  • If PinSize value is negative the caller only wants to know if the current chain of the elements Smart Card Edge protocol, Smart Card Reader protocol and Smart Card Reader supports the Secure Pin Entry PCSC V2 functionality.
  • If PinSize value is positive or null the caller ask to perform the verify PIN using the Secure PIN Entry functionality.

In PinCode buffer, the PIN value is always given in plaintext, in case of secure messaging the SMART_CARD_EDGE_PROTOCOL will be in charge of all intermediate treatments to build the correct Smart Card APDU.

Parameters
[in]ThisIndicates a pointer to the calling context.
[in]SCardHandleHandle on Smart Card connection.
[in]PinSizePIN code buffer size.
[in]PinCodePIN code to present to the Smart Card.
[out]PinResultResult of PIN code presentation to the Smart Card. TRUE when Smard Card founds the PIN code correct.
[out]RemainingAttemptsNumber of attempts still possible.
Return values
EFI_SUCCESSThe requested command completed successfully.
EFI_UNSUPPORTEDPinsize < 0 and Secure PIN Entry functionality not supported.
EFI_INVALID_PARAMETERThis is NULL.
EFI_INVALID_PARAMETERNo connection for SCardHandle value.
EFI_INVALID_PARAMETERBad value for PinSize: value not supported by Smart Card or, negative with PinCode not null.
EFI_INVALID_PARAMETERPinResult is NULL.
EFI_NO_MEDIASmart Card or Reader of SCardHandle connection has been removed. A Disconnect should be performed.

Definition at line 411 of file SmartCardEdge.h.

◆ SMART_CARD_AID

typedef UINT8 SMART_CARD_AID[SCARD_AID_MAXSIZE]

Definition at line 42 of file SmartCardEdge.h.

◆ SMART_CARD_CSN

typedef UINT8 SMART_CARD_CSN[SCARD_CSN_SIZE]

Definition at line 43 of file SmartCardEdge.h.