DataFlex
DataFlex
Example: Crypt2.SetSigningCert method
Demonstrates how to call the SetSigningCert method.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoCryptA
Variant vCertA
Handle hoCertA
Handle hoCryptB
Variant vCertB
Handle hoCertB
Handle hoCryptC
Variant vCertC
Handle hoCertC
Move False To iSuccess
// Signing certificates can be obtained from many different sources..
// Load from a PFX
Get Create (RefClass(cComChilkatCrypt2)) To hoCryptA
If (Not(IsComObjectCreated(hoCryptA))) Begin
Send CreateComObject of hoCryptA
End
Get Create (RefClass(cComChilkatCert)) To hoCertA
If (Not(IsComObjectCreated(hoCertA))) Begin
Send CreateComObject of hoCertA
End
Get ComLoadPfxFile Of hoCertA "c:/someDir/pfx_files/a.pfx" "pfx_file_password" To iSuccess
Get pvComObject of hoCertA to vCertA
Get ComSetSigningCert Of hoCryptA vCertA To iSuccess
// ...
// Load from a smart card or USB token.
Get Create (RefClass(cComChilkatCrypt2)) To hoCryptB
If (Not(IsComObjectCreated(hoCryptB))) Begin
Send CreateComObject of hoCryptB
End
Get Create (RefClass(cComChilkatCert)) To hoCertB
If (Not(IsComObjectCreated(hoCertB))) Begin
Send CreateComObject of hoCertB
End
Set ComSmartCardPin Of hoCertB To "123456"
Get ComLoadFromSmartcard Of hoCertB "" To iSuccess
Get pvComObject of hoCertB to vCertB
Get ComSetSigningCert Of hoCryptB vCertB To iSuccess
// ...
// Load from a the Windows certificate store or macOS keychain
Get Create (RefClass(cComChilkatCrypt2)) To hoCryptC
If (Not(IsComObjectCreated(hoCryptC))) Begin
Send CreateComObject of hoCryptC
End
Get Create (RefClass(cComChilkatCert)) To hoCertC
If (Not(IsComObjectCreated(hoCertC))) Begin
Send CreateComObject of hoCertC
End
Get ComLoadByCommonName Of hoCertC "Xyz 123" To iSuccess
Get pvComObject of hoCertC to vCertC
Get ComSetSigningCert Of hoCryptC vCertC To iSuccess
// ...
End_Procedure