Class FinSecurityMediaSmartCard
Abstract base class for sll smart card based IFinSecurityMedia interface
implementations.
Inheritance
System.Object
FinSecurityMediaSmartCard
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: Subsembly.FinTS.SmartCard.dll
public abstract class FinSecurityMediaSmartCard : IFinSecurityMedia, IFinSecurityMediaSmartCard
Constructors
Declaration
public FinSecurityMediaSmartCard()
Properties
Declaration
public FinSecurityMediaCaps Capabilities { get; }
Property Value
Declaration
protected CardExpress Card { get; }
Property Value
Type |
Description |
Subsembly.SmartCard.CardExpress |
|
Text encoding that is used by the text fields of the smart card.
Declaration
protected Encoding CardEncoding { get; set; }
Property Value
Type |
Description |
System.Text.Encoding |
|
Declaration
protected byte[] CardID { get; }
Property Value
Type |
Description |
System.Byte[] |
|
Declaration
public int ContactCapacity { get; }
Property Value
Type |
Description |
System.Int32 |
|
Declaration
public int MaxKeyLength { get; }
Property Value
Type |
Description |
System.Int32 |
|
Declaration
public FinSecurityMediaPassphraseFlags PassphraseFlags { get; }
Property Value
Declaration
public int PassphraseMaxLength { get; }
Property Value
Type |
Description |
System.Int32 |
|
Declaration
public int PassphraseMinLength { get; }
Property Value
Type |
Description |
System.Int32 |
|
Provides the hex representation of the EF_ID or similar file of this smart card.
Declaration
public string SecurityMediaID { get; }
Property Value
Type |
Description |
System.String |
|
This base class is meant solely for smart card based implementations, hence this
property always returns SmartCard.
Declaration
public FinSecurityMediaType SecurityMediaType { get; }
Property Value
Declaration
public FinSecurityProfile[] SecurityProfiles { get; }
Property Value
Declaration
public FinSecurityMediaState State { get; }
Property Value
Methods
Declaration
public FinAuthenticateResult Authenticate(string sUserName, string sPassphrase)
Parameters
Type |
Name |
Description |
System.String |
sUserName |
|
System.String |
sPassphrase |
|
Returns
Declaration
public FinAuthenticateResult AuthenticateAdmin(string sUserName, string sAdminPassphrase)
Parameters
Type |
Name |
Description |
System.String |
sUserName |
|
System.String |
sAdminPassphrase |
|
Returns
Declaration
public FinAuthenticateResult AuthenticateSecure()
Returns
Declaration
public bool CanAuthenticateSecure()
Returns
Type |
Description |
System.Boolean |
|
Declaration
Declaration
public bool CanChangePassphraseSecure()
Returns
Type |
Description |
System.Boolean |
|
Declaration
public FinAuthenticateResult ChangePassphrase(string sUserName, string sOldPassphrase, string sNewPassphrase)
Parameters
Type |
Name |
Description |
System.String |
sUserName |
|
System.String |
sOldPassphrase |
|
System.String |
sNewPassphrase |
|
Returns
Declaration
public FinAuthenticateResult ChangePassphraseSecure()
Returns
Declaration
protected FinAuthenticateResult ChangePin(CardPinControl aPinControl, string sOldPin, string sNewPin)
Parameters
Type |
Name |
Description |
Subsembly.SmartCard.CardPinControl |
aPinControl |
|
System.String |
sOldPin |
|
System.String |
sNewPin |
|
Returns
Declaration
protected FinAuthenticateResult ChangePinSecure(CardPinControl aPinControl)
Parameters
Type |
Name |
Description |
Subsembly.SmartCard.CardPinControl |
aPinControl |
|
Returns
Always throws a NotSupportedException.
Declaration
public void Create(string sSecurityMediaID, string sUserName, string sPassphrase)
Parameters
Type |
Name |
Description |
System.String |
sSecurityMediaID |
|
System.String |
sUserName |
|
System.String |
sPassphrase |
|
Declaration
public FinContact CreateContact()
Returns
Declaration
public byte[] Decrypt(FinContact aContact, FinSecureKey aKey, FinOperationMode nOpMode, byte[] vbCrypt)
Parameters
Returns
Type |
Description |
System.Byte[] |
|
Declaration
public void ElevateKey(FinContact aContact, FinSecureKey aKey, FinSecureKeyState nNewKeyState)
Parameters
Declaration
public byte[] Encrypt(FinContact aContact, FinSecureKey aKey, FinOperationMode nOpMode, byte[] vbData)
Parameters
Returns
Type |
Description |
System.Byte[] |
|
Declaration
public void EraseContact(int nContactIndex)
Parameters
Type |
Name |
Description |
System.Int32 |
nContactIndex |
|
Declaration
public void EraseKey(FinContact aContact, FinSecureKey aKey)
Parameters
Declaration
protected string ExtractField(byte[] vbData, int nOffset, int nLength)
Parameters
Type |
Name |
Description |
System.Byte[] |
vbData |
|
System.Int32 |
nOffset |
|
System.Int32 |
nLength |
|
Returns
Type |
Description |
System.String |
|
Declaration
protected int ExtractInteger(byte[] vbData, int nOffset, int nLength)
Parameters
Type |
Name |
Description |
System.Byte[] |
vbData |
|
System.Int32 |
nOffset |
|
System.Int32 |
nLength |
|
Returns
Type |
Description |
System.Int32 |
|
Declaration
public FinSecureKey GenerateKey(FinContact aContact, FinSecureKeyType nKeyType, int nKeyLength, int nKeyNumber, int nKeyVersion)
Parameters
Type |
Name |
Description |
FinContact |
aContact |
|
FinSecureKeyType |
nKeyType |
|
System.Int32 |
nKeyLength |
|
System.Int32 |
nKeyNumber |
|
System.Int32 |
nKeyVersion |
|
Returns
Declaration
public static SCardResourceManager GetCardResourceManager()
Returns
Type |
Description |
Subsembly.SmartCard.SCardResourceManager |
Returns an established SCardResourceManager instance or null. If a valid instance
is returned, then the caller is responsible for finally releasing and disposing
that instance.
|
Extract and validate the ContactIndex field from the given FinContact
Declaration
protected int GetContactIndex(FinContact aContact)
Parameters
Returns
Type |
Description |
System.Int32 |
|
Exceptions
Type |
Condition |
System.InvalidOperationException |
The given FinContact does not have a ContactIndex field, or it is
outside of the range supported by the card.
|
Declaration
public FinAuthenticateResult InitPassphrase(string sUserName, string sPassphrase)
Parameters
Type |
Name |
Description |
System.String |
sUserName |
|
System.String |
sPassphrase |
|
Returns
Declaration
protected void InsertField(byte[] vbData, int nOffset, int nLength, string sValue)
Parameters
Type |
Name |
Description |
System.Byte[] |
vbData |
|
System.Int32 |
nOffset |
|
System.Int32 |
nLength |
|
System.String |
sValue |
|
Declaration
protected void InsertInteger(byte[] vbData, int nOffset, int nLength, int nValue)
Parameters
Type |
Name |
Description |
System.Byte[] |
vbData |
|
System.Int32 |
nOffset |
|
System.Int32 |
nLength |
|
System.Int32 |
nValue |
|
Checks whether the given data is a blank record.
Declaration
protected bool IsBlank(byte[] vbData)
Parameters
Type |
Name |
Description |
System.Byte[] |
vbData |
|
Returns
Type |
Description |
System.Boolean |
|
Declaration
public FinContact ObtainContact(int nContactIndex)
Parameters
Type |
Name |
Description |
System.Int32 |
nContactIndex |
|
Returns
Declaration
public FinSecureKey ObtainKey(FinContact aContact, FinSecureKeyType nKeyType, int nKeyNumber, int nKeyVersion)
Parameters
Returns
Declaration
protected virtual FinAuthenticateResult OnChangePin(string sOldPin, string sNewPin)
Parameters
Type |
Name |
Description |
System.String |
sOldPin |
|
System.String |
sNewPin |
|
Returns
Declaration
protected virtual FinAuthenticateResult OnChangePinSecure()
Returns
Declaration
protected abstract byte[] OnDecrypt(FinContact aContact, FinSecureKey aKey, FinOperationMode nOpMode, byte[] vbCrypt)
Parameters
Returns
Type |
Description |
System.Byte[] |
|
Declaration
protected virtual byte[] OnEncrypt(FinContact aContact, FinSecureKey aKey, FinOperationMode nOpMode, byte[] vbData)
Parameters
Returns
Type |
Description |
System.Byte[] |
|
Declaration
protected virtual void OnEraseContact(int nContactIndex)
Parameters
Type |
Name |
Description |
System.Int32 |
nContactIndex |
|
Declaration
protected virtual void OnEraseKey(FinContact aContact, FinSecureKey aKey)
Parameters
Declaration
protected virtual FinSecureKey OnGenerateKey(FinContact aContact, FinSecureKeyType nKeyType, int nKeyLength, int nKeyNumber, int nKeyVersion)
Parameters
Type |
Name |
Description |
FinContact |
aContact |
|
FinSecureKeyType |
nKeyType |
|
System.Int32 |
nKeyLength |
|
System.Int32 |
nKeyNumber |
|
System.Int32 |
nKeyVersion |
|
Returns
Declaration
protected abstract FinSecurityMediaCaps OnGetCapabilities()
Returns
Declaration
protected abstract int OnGetContactCapacity()
Returns
Type |
Description |
System.Int32 |
|
Declaration
protected virtual int OnGetMaxKeyLength()
Returns
Type |
Description |
System.Int32 |
The default implementation always returns 96, the standard length for RDH-1 keys.
|
Declaration
protected abstract FinSecurityMediaPassphraseFlags OnGetPassphraseFlags()
Returns
Declaration
protected abstract int OnGetPassphraseMaxLength()
Returns
Type |
Description |
System.Int32 |
|
Declaration
protected virtual int OnGetPassphraseMinLength()
Returns
Type |
Description |
System.Int32 |
|
Declaration
protected virtual FinSecurityProfile[] OnGetSecurityProfiles()
Returns
Override this method in order to provide additional initialisation
for a new FinContact instance.
Declaration
protected virtual void OnInitContact(FinContact aContact)
Parameters
Declaration
protected virtual FinAuthenticateResult OnInitPin(string sPin)
Parameters
Type |
Name |
Description |
System.String |
sPin |
|
Returns
Declaration
protected abstract void OnReadContact(FinContact aContact, int nContactIndex)
Parameters
Type |
Name |
Description |
FinContact |
aContact |
|
System.Int32 |
nContactIndex |
|
Declaration
protected abstract FinSecureKey OnReadKey(FinContact aContact, FinSecureKeyType nKeyType, int nKeyNumber, int nKeyVersion)
Parameters
Returns
Must be overriden in order to clean up any context information that may have
been collected since OnSelectCard(CardExpress) was called.
Declaration
protected abstract void OnReleaseCard(CardExpress aCard)
Parameters
Type |
Name |
Description |
Subsembly.SmartCard.CardExpress |
aCard |
|
Must be override in order to implement selection of the card application.
Declaration
protected abstract byte[] OnSelectCard(CardExpress aCard)
Parameters
Type |
Name |
Description |
Subsembly.SmartCard.CardExpress |
aCard |
Handle to successfully connected card. The overriding method must use this handle
in order to access the card.
|
Returns
Type |
Description |
System.Byte[] |
If successfull, then the unique card id (EF_ID or similar) must be returned. If
the connected card does not appear to be supported, then null must be
returned.
|
Declaration
protected abstract byte[] OnSignHash(FinContact aContact, FinSecureKey aKey, FinOperationMode nOpMode, FinHash nHash, byte[] vbHash)
Parameters
Returns
Type |
Description |
System.Byte[] |
|
Declaration
protected virtual void OnUpdateKeyState(FinContact aContact, FinSecureKey aKey)
Parameters
Declaration
protected virtual bool OnVerify(FinContact aContact, FinSecureKey aKey, FinOperationMode nOpMode, FinHash nHash, byte[] vbHash, byte[] vbSignature)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Declaration
protected abstract FinAuthenticateResult OnVerifyPin(string sPin)
Parameters
Type |
Name |
Description |
System.String |
sPin |
PIN to verify. This is never null.
|
Returns
Invoked whenever the PIN was successfully verified and the object switches
into the Authenticated state.
Declaration
protected virtual void OnVerifyPinOK()
Declaration
protected abstract FinAuthenticateResult OnVerifyPinSecure()
Returns
Declaration
protected virtual void OnWriteContact(FinContact aContact, int nContactIndex)
Parameters
Type |
Name |
Description |
FinContact |
aContact |
|
System.Int32 |
nContactIndex |
|
Declaration
protected virtual void OnWriteKey(FinContact aContact, FinSecureKey aKey)
Parameters
Declaration
protected byte[] ReadBinary(int nOffset, int nLength)
Parameters
Type |
Name |
Description |
System.Int32 |
nOffset |
|
System.Int32 |
nLength |
|
Returns
Type |
Description |
System.Byte[] |
|
Declaration
protected byte ReadByte(int nOffset)
Parameters
Type |
Name |
Description |
System.Int32 |
nOffset |
|
Returns
Type |
Description |
System.Byte |
|
Declaration
protected byte[] ReadRecord(int nRecNo, int nLength)
Parameters
Type |
Name |
Description |
System.Int32 |
nRecNo |
|
System.Int32 |
nLength |
|
Returns
Type |
Description |
System.Byte[] |
|
Declaration
Declaration
public void ResetKey(FinContact aContact, FinSecureKey aKey)
Parameters
Declaration
public FinAuthenticateResult Select(string sSecurityMediaID)
Parameters
Type |
Name |
Description |
System.String |
sSecurityMediaID |
|
Returns
Declaration
public string SelectCard(string sReaderName)
Parameters
Type |
Name |
Description |
System.String |
sReaderName |
|
Returns
Type |
Description |
System.String |
|
Declaration
protected void SelectFile(int nFileID)
Parameters
Type |
Name |
Description |
System.Int32 |
nFileID |
|
Declaration
protected CardResponseAPDU SendCommand(CardCommandAPDU aCmdAPDU)
Parameters
Type |
Name |
Description |
Subsembly.SmartCard.CardCommandAPDU |
aCmdAPDU |
|
Returns
Type |
Description |
Subsembly.SmartCard.CardResponseAPDU |
|
Declaration
public byte[] SignHash(FinContact aContact, FinSecureKey aKey, FinOperationMode nOpMode, FinHash nHash, byte[] vbHash)
Parameters
Returns
Type |
Description |
System.Byte[] |
|
Declaration
public void StoreContact(int nContactIndex, FinContact aContact)
Parameters
Type |
Name |
Description |
System.Int32 |
nContactIndex |
|
FinContact |
aContact |
|
Declaration
public void StoreKey(FinContact aContact, FinSecureKey aKey)
Parameters
Declaration
protected void UpdateBinary(int nOffset, byte[] vbData)
Parameters
Type |
Name |
Description |
System.Int32 |
nOffset |
|
System.Byte[] |
vbData |
|
Declaration
protected void UpdateByte(int nOffset, byte nByte)
Parameters
Type |
Name |
Description |
System.Int32 |
nOffset |
|
System.Byte |
nByte |
|
Declaration
protected void UpdateRecord(int nRecNo, byte[] vbData)
Parameters
Type |
Name |
Description |
System.Int32 |
nRecNo |
|
System.Byte[] |
vbData |
|
Declaration
public bool Verify(FinContact aContact, FinSecureKey aKey, FinOperationMode nOpMode, FinHash nHash, byte[] vbHash, byte[] vbSignature)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Declaration
protected FinAuthenticateResult VerifyPin(CardPinControl aPinControl, string sPin)
Parameters
Type |
Name |
Description |
Subsembly.SmartCard.CardPinControl |
aPinControl |
|
System.String |
sPin |
|
Returns
Declaration
protected FinAuthenticateResult VerifyPinSecure(CardPinControl aPinControl)
Parameters
Type |
Name |
Description |
Subsembly.SmartCard.CardPinControl |
aPinControl |
|
Returns
Implements