OverrideKey

Declaration

Delphi

function OverrideKey(KeyType: Integer; Data: Pointer; Size: Cardinal; Password, KeyAlias: PChar): Boolean;

ActiveX

HRESULT OverrideKey([in] long KeyType, [in] VARIANT data, [in] BSTR Password, [in] BSTR KeyAlias, [out, retval] VARIANT_BOOL* RetVal);

Description

Startcapture replaces setPadSettings and startRead (Both functions are still available for backward compatibility).

To clear overridden key and revert back to default key, pass nil-pointer or zero-size array.

Arguments

KeyType

defines type of key to override.

ValueMeaning
0root public
1root private


Data

Pointer to binary array with key data. For ActiveX control: one-dimensional array.

Size

Key size in bytes.

Password

Encryption key password

KeyAlias

If Data block contains more than one key, the KeyAlias parameter specifies which key to use.

Return value

returns True if key was successfully overridden, false otherwise.


Sample

C#
string certPath = @"Test.pfx";
string certPass = "demo123";

Byte[] contentBytes = File.ReadAllBytes(certPath);

//boxing to the object
object comObject = contentBytes;

bool privatKey = SigDev.OverrideKey(0, comObject, certPass, "");
bool publicKey = SigDev.OverrideKey(1, comObject, certPass, "");
                
//  Disable Confirmdialog (Digital Signature will be added by Driver instead from the Pad)
SigDev.SetDriverLong(0, SigDev.GetDriverLong(0) | 0x00010A90);

Download Test.pfx file for a tests