This sample demonstrates how to digitally sign a file or a block of memory data using the RSA signing methods.
Project path: SAMPLES\VISUAL C++ 6-7\RSASIGN
Project file name: RSASIGN.DSP
Properties: Signature, PrivateKey and SigningMethod
Methods: SetRandomKeyPair, ReadFile and Sign
This sample is a console application that can perform two operations:
1. Generate a new key pair
This operation needs exactly three parameters. The sample's command-line usage specifications are:
RSASign /g=key_size private_key_file public_key_file
where key_size is the key pair strength in bits (e.g., 1024)
private_key_file is the file name where will be stored the generated private key public_key_file is the file name where will be stored the generated public key
2. Sign a file
This operation needs at least two parameters. The sample's command-line usage specifications are:
RSASign [/h | /?] [input_file] private_key_file signature_file
where the options /h or /? are used to show help about this sample program
input_file is the file to sign;
private_key_file is the file containing the private key that will be used to sign;
signature_file is the signature destination file.
The parameters between brackets are optional. If the input file name is omitted, the text to sign is read from the console.