PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Validity of certificate (syntax 1)
  • Managing certificates in WEBDEV
  • Limits
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Creates the signature of a character string.
Versions 22 and later
Note: The syntax 2 is available via the module dated July 28, 2017 (example of compliance for accountancy software available in the additional examples)Note: The syntax 2 is available via Update 5 of WINDEV, WEBDEV et WINDEV Mobile 22 (example of compliance for accountancy software available in the additional examples)
New in version 22
Note: The syntax 2 is available via the module dated July 28, 2017 (example of compliance for accountancy software available in the additional examples)Note: The syntax 2 is available via Update 5 of WINDEV, WEBDEV et WINDEV Mobile 22 (example of compliance for accountancy software available in the additional examples)
Note: The syntax 2 is available via the module dated July 28, 2017 (example of compliance for accountancy software available in the additional examples)Note: The syntax 2 is available via Update 5 of WINDEV, WEBDEV et WINDEV Mobile 22 (example of compliance for accountancy software available in the additional examples)
Note: An example of compliance for accountancy software, using the syntax 2, is available in the additional examples.
Versions 23 and later
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
WEBDEV - Server codeLinux This function is now available for the WEBDEV sites in Linux.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
New in version 23
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
WEBDEV - Server codeLinux This function is now available for the WEBDEV sites in Linux.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
WEBDEV - Server codeLinux This function is now available for the WEBDEV sites in Linux.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
WINDEVReports and QueriesUser code (UMC)
// String signature according to a certificate installed on the computer
// Caution: this syntax is using a Certificate variable.
// This syntax is not compatible with the compliance
// of accounting software (NF525 standard).
// The example corresponding to the NF525 standard is available in
// the additional examples

MyCertificate is Certificate

// Open the certificate picker of Windows
MyCertificate = CertificateSelect()
// Cancelation or error
IF MyCertificate..Name = "" THEN
RETURN
END

// Checks the certificate validity for the signature
IF MyCertificate..ValidForSignature = False THEN
Info("The selected certificate cannot be used to generate a signature.")
RETURN
END

// Retrieve the buffer containing the signature
bufSignature is Buffer
bufSignature = CertificateSignString("Character string to sign", MyCertificate)

// Retrieve the certificate found in the signature buffer
MyExtractedCertificate is Certificate
MyExtractedCertificate = CertificateExtract(buffSignature)

// Manage the errors
IF MyExtractedCertificate = Null THEN
RETURN
END

// Open the window for certificate properties
CertificateOpenProperties(MyExtractedCertificate)
Syntax
WINDEVWEBDEV - Server codeReports and QueriesLinuxUser code (UMC)

Signing a string via a Certificate variable Hide the details

<Result> = CertificateSignString(<String to Sign> , <Certificate>)
<Result>: Buffer
Signature of string (in PKCS7 format (DER)). This buffer can be used later by CertificateCheckString to check the correspondence between the signature and the string.
<String to Sign>: Ansi or Unicode character string (with quotes) or Buffer
Character string to sign.
<Certificate>: Certificate variable
Name of Certificate variable containing the certificate that will be used to sign the string.
Versions 22 and later
Syntax available via the module dated July 28, 2017 (example of compliance for accountancy software available in the additional examples)Syntax available via Update 5 of WINDEV, WEBDEV et WINDEV Mobile 22 (example of compliance for accountancy software available in the additional examples)
New in version 22
Syntax available via the module dated July 28, 2017 (example of compliance for accountancy software available in the additional examples)Syntax available via Update 5 of WINDEV, WEBDEV et WINDEV Mobile 22 (example of compliance for accountancy software available in the additional examples)
Syntax available via the module dated July 28, 2017 (example of compliance for accountancy software available in the additional examples)Syntax available via Update 5 of WINDEV, WEBDEV et WINDEV Mobile 22 (example of compliance for accountancy software available in the additional examples)

Signing a string via a numeric signature Hide the details

<Result> = CertificateSignString(<String to Sign> , <Certificate File> , <Password> , <Option>)
<Result>: Buffer
Signature of string (in requested format). This buffer can be used later by CertificateCheckString to check the correspondence between the signature and the string.
<String to Sign>: Ansi or Unicode character string (with quotes) or Buffer
Character string to sign.
<Certificate File>: Character string (with quotes)
Full path to a PKCS12 file (.p12/.pfx) containing the private key and the certificates. This file can be included in the application library (WDL file).
<Password>: Character string (with quotes)
Password that will be used to decrypt the certificate file if this one is password protected.
<Option>: Integer constant (or combination of constants)
Allows you to specify:
  • the hashing algorithm used (optional for a signature in PKCS7 format):
    certMD5MD5 algorithm.
    Not recommended because unreliable. This type of algorithm is not allowed with the "elliptic curve" signatures.
    certSHA160SHA1 algorithm.
    certSHA256SHA2 algorithm. A 256-bit result is produced.
    certSHA384SHA-384 algorithm. A 384-bit result is produced.
    This type of algorithm is not supported by the "DSA" signatures.
    certSHA512SHA-512 algorithm. A 512-bit result is produced.
    This type of algorithm is not supported by the "DSA" signatures.
  • the signature format:
    certPKCS7EnvelopedContainer in PKCS7 format (DER) containing the signature, the string of certificates and the signed data.
    Note: if this constant is used, the hashing algorithm is optional. If it is not specified, an appropriate algorithm will be automatically chosen.
    certPKCS7Enveloped + certPKCS7PEMContainer in PKCS7 format (PEM) containing the signature, the string of certificates and the signed data.
    Note: if this constant is used, the hashing algorithm is optional. If it is not specified, an appropriate algorithm will be automatically chosen.
    certPKCS7WithCertificateContainer in PKCS7 format (DER) containing the signature and the string of certificates.
    Note: if this constant is used, the hashing algorithm is optional. If it is not specified, an appropriate algorithm will be automatically chosen.
    certPKCS7WithCertificate + certPKCS7PEMContainer in PKCS7 format (PEM) containing the signature and the string of certificates.
    Note: if this constant is used, the hashing algorithm is optional. If it is not specified, an appropriate algorithm will be automatically chosen.
    certPKCS7WithoutCertificateContainer in PKCS7 format (DER) containing the signature.
    Note: if this constant is used, the hashing algorithm is optional. If it is not specified, an appropriate algorithm will be automatically chosen.
    certPKCS7WithoutCertificate + certPKCS7PEMContainer in PKCS7 format (PEM) containing the signature.
    Note: if this constant is used, the hashing algorithm is optional. If it is not specified, an appropriate algorithm will be automatically chosen.
    certSignatureOnlyThe output contains the rough signature, without container.
    This options is required for the compliance of accountancy software (NF525 standard). With this option, only the key section of PFX file will be used (the certificate section containing the date will not be used).
    Caution: if this constant is used, the hashing algorithm must be specified.
Note: The signature algorithm is defined by the private key (RSA, DSA, Elliptic curve).
Remarks

Validity of certificate (syntax 1)

Before signing a string, we advise you to check the certificate validity (..ValidForSignature property of Certificate variable). This property is used to find out whether the certificate owns a private key as well as all the characteristics required to perform a signature. CertificateSignString returns an error if this property is set to False.
WEBDEV - Server code

Managing certificates in WEBDEV

In order for the certificates to be visible to the site user, they must be installed on the server in the store of custom certificates of the Internet user.
AndroidAndroid Widget

Limits

This function is available for the devices equipped with ARM processors. A fatal error occurs if this function is used with devices not equipped with ARM processors (x86, mips, ...). This function is available for the devices equipped with ARM processors or using an ARM emulation. Otherwise (and on the Samsung Galaxy Tab 3 tablet), a fatal error will occur.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230std.dll
Linux wd230std.so
Android wd230android.jar
Minimum required version
  • Version 16
This page is also available for…
Comments
Click [Add] to post a comment