IPWorks Encrypt 2020 PHP Edition

Questions / Feedback?

DSA Class

Properties   Methods   Events   Configuration Settings   Errors  

The DSA (Digital Signature Algorithm) class enables users to generate DSA hash signatures.

Class Name

IPWorksEncrypt_DSA

Procedural Interface

 ipworksencrypt_dsa_open();
 ipworksencrypt_dsa_close($res);
 ipworksencrypt_dsa_register_callback($res, $id, $function);
 ipworksencrypt_dsa_get_last_error($res);
 ipworksencrypt_dsa_get_last_error_code($res);
 ipworksencrypt_dsa_set($res, $id, $index, $value);
 ipworksencrypt_dsa_get($res, $id, $index);
 ipworksencrypt_dsa_do_config($res, $configurationstring);
 ipworksencrypt_dsa_do_createkey($res);
 ipworksencrypt_dsa_do_reset($res);
 ipworksencrypt_dsa_do_sign($res);
 ipworksencrypt_dsa_do_verifysignature($res);

Remarks

The DSA (Digital Signature Algorithm) class enables users to generate DSA hash signatures.

To begin you must either specify an existing key or create a new key. Existing private keys may be specified by setting the Key* properties. To create a new key call CreateKey. Alternatively an existing certificate may be specified by setting the Certificate* properties

Signing

To sign data first set Key or Certificate. Select the input file by setting InputFile or InputMessage. Next call Sign. The Sign method will automatically compute the hash, and then sign the hash with the specified key.

Send the public key (see CreateKey for details), file, and HashSignature to the recipient.

To sign a hash without recomputing the hash simply set HashValue to the pre-computed hash value before calling Sign.

Signature Verification

To verify a signature specify the input data using InputFile or InputMessage. Set SignerKey or SignerCert. Next set HashSignature and call VerifySignature. The VerifySignature method will return True if the signature was successfully verified.

To verify a hash signature without recomputing the hash simply set HashValue to the pre-computed hash value before calling VerifySignature.

Hash Notes

The class will determine whether or not to recompute the hash based on the properties that are set. If a file is specified by InputFile or InputMessage the hash will be recomputed when calling Sign or VerifySignature. If the HashValue property is set the class will only sign the hash or verify the hash signature. Setting InputFile or InputMessage clears the HashValue property. Setting the HashValue property clears the input file selection.

DSA Key Notes

A DSA key is made up of a number of individual parameters. When calling CreateKey the Key* properties are populated with a new private and public key.

After calling Sign the public key must be sent to the recipient along with HashSignature so they may perform signature verification. Likewise you must obtain the public key along with HashSignature in order to perform signature verification.

The public key consists of the following parameters:

The class also includes the KeyPublicKey property which holds the PEM formatted public key for ease of use. This is helpful if you are in control of both signature creation and verification process. When sending the public key to a recipient note that not all implementations will support using the PEM formatted value in KeyPublicKey in which case the individual parameters must be sent.

The private key consists of the following parameters:

The class also include the KeyPrivateKey property which holds the PEM formatted private key for ease of use. This is helpful for storing the private key more easily..

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

CertEncodedThe certificate (PEM/base64 encoded).
CertStoreThe name of the certificate store for the client certificate.
CertStorePasswordIf the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.
CertStoreTypeThe type of certificate store for this certificate.
CertSubjectThe subject of the certificate used for client authentication.
HashAlgorithmThe hash algorithm used for hash computation.
HashSignatureThe hash signature.
HashValueThe hash value of the data.
InputFileThe file to process.
InputMessageThe message to process.
KeyGRepresents the G parameter for the DSA algorithm.
KeyPRepresents the P parameter for the DSA algorithm.
KeyPrivateKeyThis property is a PEM formatted private key.
KeyPublicKeyThis property is a PEM formatted public key.
KeyQRepresents the Q parameter for the DSA algorithm.
KeyXRepresents the X parameter for the DSA algorithm.
KeyYRepresents the Y parameter for the DSA algorithm.
SignerCertEncodedThe certificate (PEM/base64 encoded).
SignerCertStoreThe name of the certificate store for the client certificate.
SignerCertStorePasswordIf the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.
SignerCertStoreTypeThe type of certificate store for this certificate.
SignerCertSubjectThe subject of the certificate used for client authentication.
SignerKeyGRepresents the G parameter for the DSA algorithm.
SignerKeyPRepresents the P parameter for the DSA algorithm.
SignerKeyPublicKeyThis property is a PEM formatted public key.
SignerKeyQRepresents the Q parameter for the DSA algorithm.
SignerKeyYRepresents the Y parameter for the DSA algorithm.
UseHexWhether HashValue and HashSignature are hex encoded.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

ConfigSets or retrieves a configuration setting.
CreateKeyCreates a new key.
ResetResets the class.
SignCreates a hash signature.
VerifySignatureVerifies the signature for the specified data.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

ErrorInformation about errors during data delivery.
ProgressFired as progress is made.

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

HashSignatureFormatThe format of the HashSignature.
KeyFormatHow the public and private key are formatted.
KeySizeThe size, in bits, of the secret key.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Encrypt 2020 PHP Edition - Version 20.0 [Build 8155]