Class FinSecurityMediaVoid
Implements a RDH security media that simply stores the secret keys in the associated FinContact instance.
Inheritance
Implements
Inherited Members
Namespace: Subsembly.FinTS
Assembly: Subsembly.FinTS.Core.dll
Syntax
public class FinSecurityMediaVoid : IFinSecurityMedia
Remarks
In order to maintain strong security the key data is thoroughly encrypted before it is stored in the FinContact. The encryption is done based on the given passphrase. The SecurityMediaID is used to store a hash value of the passphrase for quick verification.
Constructors
FinSecurityMediaVoid(FinContact)
Special constructor only.
Declaration
public FinSecurityMediaVoid(FinContact aContact)
Parameters
Type | Name | Description |
---|---|---|
FinContact | aContact | The FinContact where all data of this security media implementation is stored. |
Remarks
Constructs an instance that uses the given FinContact to store all its data. The given FinContact instance must be the same as the one which is passed to the other methods of this class which have a FinContact parameter.
This class does not provide a default contructor and therefore cannot be created like other security media implementations. Whevever a FinContact indicates that it uses the FinSecurityMediaType.Void the FinContact will use this special constructor passing itself as the parameter
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The parameter aContact was |
Properties
Capabilities
Provides the capabilities of this implementation.
Declaration
public FinSecurityMediaCaps Capabilities { get; }
Property Value
Type | Description |
---|---|
FinSecurityMediaCaps |
ContactCapacity
Always 1.
Declaration
public int ContactCapacity { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
MaxKeyLength
Declaration
public int MaxKeyLength { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
PassphraseFlags
Provides the attributes of the passphrase.
Declaration
public FinSecurityMediaPassphraseFlags PassphraseFlags { get; }
Property Value
Type | Description |
---|---|
FinSecurityMediaPassphraseFlags |
PassphraseMaxLength
Provides the maximum length that is acceptable for a passphrase for this security media implementation.
Declaration
public int PassphraseMaxLength { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
PassphraseMinLength
Provides the minimum length that is acceptable for a passphrase for this security media implementation.
Declaration
public int PassphraseMinLength { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
SecurityMediaID
The currently selected security media ID.
Declaration
public string SecurityMediaID { get; }
Property Value
Type | Description |
---|---|
System.String | If the instance is in the Null state, then this
property will be |
SecurityMediaType
Always returns Void.
Declaration
public FinSecurityMediaType SecurityMediaType { get; }
Property Value
Type | Description |
---|---|
FinSecurityMediaType |
SecurityProfiles
Declaration
public FinSecurityProfile[] SecurityProfiles { get; }
Property Value
Type | Description |
---|---|
FinSecurityProfile[] |
State
The current state of this security media instance.
Declaration
public FinSecurityMediaState State { get; }
Property Value
Type | Description |
---|---|
FinSecurityMediaState |
Methods
Authenticate(String, String)
Authenticates the passphrase and switches into the Authenticated State.
Declaration
public FinAuthenticateResult Authenticate(string sUserName, string sPassphrase)
Parameters
Type | Name | Description |
---|---|---|
System.String | sUserName | Is completely ignored. |
System.String | sPassphrase | The passphrase to authenticate. |
Returns
Type | Description |
---|---|
FinAuthenticateResult | If the parameter sPassphrase was If the passphrase was wrong, then WrongPassphrase is returned. There is no limit on the number of attempts. If the passphrase was correct, then Success is returned and the instance switches into the Authenticated State. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The current State was neither Selected nor Authenticated. |
AuthenticateAdmin(String, String)
Not supported.
Declaration
public FinAuthenticateResult AuthenticateAdmin(string sUserName, string sAdminPassphrase)
Parameters
Type | Name | Description |
---|---|---|
System.String | sUserName | |
System.String | sAdminPassphrase |
Returns
Type | Description |
---|---|
FinAuthenticateResult |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | This exception is always thrown when this method is called. |
AuthenticateSecure()
Not supported.
Declaration
public FinAuthenticateResult AuthenticateSecure()
Returns
Type | Description |
---|---|
FinAuthenticateResult | Always returns AuthenticateSecureNotSupported. |
CanAuthenticateSecure()
Declaration
public bool CanAuthenticateSecure()
Returns
Type | Description |
---|---|
System.Boolean |
Cancel()
Cancels the Authenticated state and returns into the Selected state.
Declaration
public void Cancel()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The current State was neither Selected nor Authenticated. |
CanChangePassphraseSecure()
Declaration
public bool CanChangePassphraseSecure()
Returns
Type | Description |
---|---|
System.Boolean |
ChangePassphrase(String, String, String)
Change the passphrase and switch into the Authenticated State.
Declaration
public FinAuthenticateResult ChangePassphrase(string sUserName, string sOldPassphrase, string sNewPassphrase)
Parameters
Type | Name | Description |
---|---|---|
System.String | sUserName | Is completely ignored. |
System.String | sOldPassphrase | The current passphrase is needed for a successful authentication. |
System.String | sNewPassphrase | This will become the new passphrase that is assigned to this instance. |
Returns
Type | Description |
---|---|
FinAuthenticateResult |
Remarks
If one of the passphrase parameters was null
, or a passphrase did not
match the PassphraseMinLength or PassphraseMaxLength,
then BadPassphrase is returned.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException |
ChangePassphraseSecure()
Not supported.
Declaration
public FinAuthenticateResult ChangePassphraseSecure()
Returns
Type | Description |
---|---|
FinAuthenticateResult | Always returns AuthenticateSecureNotSupported. |
Create(String, String, String)
Creates an all new security media and switch directly into the Authenticated State.
Declaration
public void Create(string sSecurityMediaID, string sUserName, string sPassphrase)
Parameters
Type | Name | Description |
---|---|---|
System.String | sSecurityMediaID | As the implementation of this class does not use an external key file in order to store the secret keys, this parameter is largely ignored. However, whatever string will be passed here is stored in the SecurityMediaID property. |
System.String | sUserName | Is completely ignored. |
System.String | sPassphrase | The new passphrase that shall be used to protect the secret key data which will be stored in the associated contact. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The parameter sPassphrase was |
System.ArgumentException | The parameter sPassphrase did not match the required PassphraseMinLength or PassphraseMaxLength. |
System.InvalidOperationException |
CreateContact()
Not supported!
Declaration
public FinContact CreateContact()
Returns
Type | Description |
---|---|
FinContact |
Decrypt(FinContact, FinSecureKey, FinOperationMode, Byte[])
Declaration
public byte[] Decrypt(FinContact aContact, FinSecureKey aKey, FinOperationMode nOpMode, byte[] vbCrypt)
Parameters
Type | Name | Description |
---|---|---|
FinContact | aContact | The contact for which to compute the signature. This must be the same as the FinContact instance that was passed to the constructor. |
FinSecureKey | aKey | |
FinOperationMode | nOpMode | |
System.Byte[] | vbCrypt |
Returns
Type | Description |
---|---|
System.Byte[] |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | One of the parameters aContact, aKey, or vbCrypt was |
System.InvalidOperationException | The given aContact was not the same instance as the FinContact that was passed to the constructor; or the current State was not Authenticated. |
ElevateKey(FinContact, FinSecureKey, FinSecureKeyState)
Declaration
public void ElevateKey(FinContact aContact, FinSecureKey aKey, FinSecureKeyState nNewKeyState)
Parameters
Type | Name | Description |
---|---|---|
FinContact | aContact | The contact for which to retrieve the key. This must be the same as the FinContact instance that was passed to the constructor. |
FinSecureKey | aKey | |
FinSecureKeyState | nNewKeyState |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The parameter aContact or aKey was |
System.ArgumentException | The type of the given keys was none of the supported user key types. |
System.InvalidOperationException | The given aContact was not the same instance as the FinContact that was passed to the constructor; or the current State was not Authenticated; or the new key state was less than the current key state of the key. |
Encrypt(FinContact, FinSecureKey, FinOperationMode, Byte[])
Not supported.
Declaration
public byte[] Encrypt(FinContact aContact, FinSecureKey aKey, FinOperationMode nOpMode, byte[] vbData)
Parameters
Type | Name | Description |
---|---|---|
FinContact | aContact | |
FinSecureKey | aKey | |
FinOperationMode | nOpMode | |
System.Byte[] | vbData |
Returns
Type | Description |
---|---|
System.Byte[] | Returns always |
EraseContact(Int32)
Not supported!
Declaration
public void EraseContact(int nContactIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | nContactIndex |
EraseKey(FinContact, FinSecureKey)
Declaration
public void EraseKey(FinContact aContact, FinSecureKey aKey)
Parameters
Type | Name | Description |
---|---|---|
FinContact | aContact | The contact for which to retrieve the key. This must be the same as the FinContact instance that was passed to the constructor. |
FinSecureKey | aKey | The key to be erased. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The parameter aContact or aKey was |
System.ArgumentException | The key type was none of the supported user key types. |
System.InvalidOperationException | The given aContact was not the same instance as the FinContact that was passed to the constructor; or the current State was not Authenticated. |
GenerateKey(FinContact, FinSecureKeyType, Int32, Int32, Int32)
Generates a new public/private key pair.
Declaration
public FinSecureKey GenerateKey(FinContact aContact, FinSecureKeyType nKeyType, int nKeyLength, int nKeyNumber, int nKeyVersion)
Parameters
Type | Name | Description |
---|---|---|
FinContact | aContact | The contact for which to retrieve the key. This must be the same as the FinContact instance that was passed to the constructor. |
FinSecureKeyType | nKeyType | |
System.Int32 | nKeyLength | |
System.Int32 | nKeyNumber | |
System.Int32 | nKeyVersion |
Returns
Type | Description |
---|---|
FinSecureKey |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The parameter aContact was |
System.ArgumentOutOfRangeException | The key length, or the key number, or the key version was outside the supported range. |
System.ArgumentException | The key type was none of the supported user key types. |
System.InvalidOperationException | The given aContact was not the same instance as the FinContact that was passed to the constructor; or the current State was not Authenticated. |
InitPassphrase(String, String)
Not supported.
Declaration
public FinAuthenticateResult InitPassphrase(string sUserName, string sPassphrase)
Parameters
Type | Name | Description |
---|---|---|
System.String | sUserName | |
System.String | sPassphrase |
Returns
Type | Description |
---|---|
FinAuthenticateResult |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | This exception is always thrown when this method is called. |
ObtainContact(Int32)
Not supported!
Declaration
public FinContact ObtainContact(int nContactIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | nContactIndex |
Returns
Type | Description |
---|---|
FinContact |
ObtainKey(FinContact, FinSecureKeyType, Int32, Int32)
Find and obtain reference to crypto key from security media.
Declaration
public FinSecureKey ObtainKey(FinContact aContact, FinSecureKeyType nKeyType, int nKeyNumber, int nKeyVersion)
Parameters
Type | Name | Description |
---|---|---|
FinContact | aContact | The contact for which to retrieve the key. This must be the same as the FinContact instance that was passed to the constructor. |
FinSecureKeyType | nKeyType | Must be either UserCipheringKey or UserAuthenticationKey. |
System.Int32 | nKeyNumber | Is ignored. |
System.Int32 | nKeyVersion | Is ignored. |
Returns
Type | Description |
---|---|
FinSecureKey | Returns the requested key, or |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The parameter aContact was |
System.InvalidOperationException | The given aContact was not the same instance as the FinContact that was passed to the constructor; or the current State was not Authenticated. |
Release()
Release security media and all its resources and return into the Null state.
Declaration
public void Release()
ResetKey(FinContact, FinSecureKey)
Declaration
public void ResetKey(FinContact aContact, FinSecureKey aKey)
Parameters
Type | Name | Description |
---|---|---|
FinContact | aContact | The contact for which to retrieve the key. This must be the same as the FinContact instance that was passed to the constructor. |
FinSecureKey | aKey |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The parameter aContact or aKey was |
System.ArgumentException | The type of the given keys was none of the supported user key types. |
System.InvalidOperationException | The given aContact was not the same instance as the FinContact that was passed to the constructor; or the current State was not Authenticated; or the new key state was less than the current key state of the key. |
Select(String)
Declaration
public FinAuthenticateResult Select(string sSecurityMediaID)
Parameters
Type | Name | Description |
---|---|---|
System.String | sSecurityMediaID | The security media ID to select. |
Returns
Type | Description |
---|---|
FinAuthenticateResult | This implementation never fails and therefore always returns Success. |
SignHash(FinContact, FinSecureKey, FinOperationMode, FinHash, Byte[])
Compute user signature for given hash value.
Declaration
public byte[] SignHash(FinContact aContact, FinSecureKey aKey, FinOperationMode nOpMode, FinHash nHash, byte[] vbHash)
Parameters
Type | Name | Description |
---|---|---|
FinContact | aContact | The contact for which to compute the signature. This must be the same as the FinContact instance that was passed to the constructor. |
FinSecureKey | aKey | |
FinOperationMode | nOpMode | |
FinHash | nHash | |
System.Byte[] | vbHash |
Returns
Type | Description |
---|---|
System.Byte[] |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | One of the parameters aContact, aKey, or vbHash was |
System.InvalidOperationException | The given aContact was not the same instance as the FinContact that was passed to the constructor; or the current State was not Authenticated. |
StoreContact(Int32, FinContact)
Not supported!
Declaration
public void StoreContact(int nContactIndex, FinContact aContact)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | nContactIndex | |
FinContact | aContact |
StoreKey(FinContact, FinSecureKey)
Stores the given key in this security media.
Declaration
public void StoreKey(FinContact aContact, FinSecureKey aKey)
Parameters
Type | Name | Description |
---|---|---|
FinContact | aContact | The contact for which to store the key. This must be the same as the FinContact instance that was passed to the constructor. |
FinSecureKey | aKey | The key to be stored. This must be one of the supported user key types. |
Remarks
The implementation of this method is very special, and is different from the semantics defined for this method by the IFinSecurityMedia interface. Instead of using this method in order to store bank keys, this implementation supports storing user keys.
The very special nature of this method makes it possible to copy user keys from a key file into this security media.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The parameter aContact was |
System.ArgumentException | The type of the given key was not one of the supported user key types. |
System.InvalidOperationException | The given aContact was not the same instance as the FinContact that was passed to the constructor; or the current State was not Authenticated. |
Verify(FinContact, FinSecureKey, FinOperationMode, FinHash, Byte[], Byte[])
Not supported.
Declaration
public bool Verify(FinContact aContact, FinSecureKey aKey, FinOperationMode nOpMode, FinHash nHash, byte[] vbHash, byte[] vbSignature)
Parameters
Type | Name | Description |
---|---|---|
FinContact | aContact | |
FinSecureKey | aKey | |
FinOperationMode | nOpMode | |
FinHash | nHash | |
System.Byte[] | vbHash | |
System.Byte[] | vbSignature |
Returns
Type | Description |
---|---|
System.Boolean | Returns always |