Rsa ActiveX Reference Documentation

Rsa

RSA encryption component / library. Encrypt and decrypt byte arrays and strings. Generate public/private key pairs from 384 to 4096 bits in length. Import and export RSA keys. Import keys from SNK files. Input/output in raw binary, base64, hex encoding, quoted-printable, URL-encoding, etc.

Object Creation

(Visual Basic 6.0)
Dim obj As New ChilkatRsa

(ASP)
set obj = Server.CreateObject("Chilkat_9_5_0.Rsa")

(VBScript)
set obj = CreateObject("Chilkat_9_5_0.Rsa")

(Delphi)
obj := TChilkatRsa.Create(Self);

(FoxPro)
loObject = CreateObject('Chilkat_9_5_0.Rsa')

(PowerBuilder)
lole_object = create oleobject
li_rc = lole_object.ConnectToNewObject("Chilkat_9_5_0.Rsa")

(SQL Server)
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Rsa', @obj OUT

(Javascript)
var obj = new ActiveXObject("Chilkat_9_5_0.Rsa");

Properties

Charset As String

This property only applies when encrypting, decrypting, signing, or verifying signatures for strings. When encrypting strings, the input string is first converted to this charset before encrypting.

When decrypting, the decrypted data is interpreted as a string with this charset encoding and converted to the appropriate return. For example, ActiveX's returning strings always return Unicode (2 bytes/char). Java strings are utf-8. Chilkat C++ strings are ANSI or utf-8. .NET strings are Unicode.

When signing string data, the input string is first converted to this charset before being hashed and signed. When verifying the signature for string data, the input string is first converted to this charset before the verification process begins.

(Classic ASP) Charset Considerations when RSA Encrypting Strings

(Visual FoxPro) Charset Considerations when RSA Encrypting Strings

(PowerBuilder) Charset Considerations when RSA Encrypting Strings

(SQL Server) Charset Considerations when RSA Encrypting Strings

(Visual Basic 6.0) Charset Considerations when RSA Encrypting Strings

(VBScript) Charset Considerations when RSA Encrypting Strings

DebugLogFilePath As String

If set to a file path, causes each Chilkat method or property call to automatically append it's LastErrorText to the specified log file. The information is appended such that if a hang or crash occurs, it is possible to see the context in which the problem occurred, as well as a history of all Chilkat calls up to the point of the problem. The VerboseLogging property can be set to provide more detailed information.

This property is typically used for debugging the rare cases where a Chilkat method call hangs or generates an exception that halts program execution (i.e. crashes). A hang or crash should generally never happen. The typical causes of a hang are:

  1. a timeout related property was set to 0 to explicitly indicate that an infinite timeout is desired,
  2. the hang is actually a hang within an event callback (i.e. it is a hang within the application code), or
  3. there is an internal problem (bug) in the Chilkat code that causes the hang.

EncodingMode As String

Encoding mode to be used in methods ending in "ENC", such as EncryptStringENC. Valid EncodingModes are "base64", "hex", "url", or "quoted-printable" (or "qp"). Encryption methods ending in "ENC" will return encrypted data as a string encoded according to this property's value. Decryption methods ending in "ENC" accept an encoded string as specified by this property. The string is first decoded and then decrypted. The default value is "base64".

This property also applies to the "ENC" methods for creating and verifying digital signatures.

(Classic ASP) Base64url Encoding

(Visual FoxPro) Base64url Encoding

(PowerBuilder) Base64url Encoding

(SQL Server) Base64url Encoding

(Visual Basic 6.0) Base64url Encoding

(VBScript) Base64url Encoding

LastBinaryResult As Variant (read-only)

Introduced in version 9.5.0.52

The binary data returned by the last (binary data returning) method called. Only available if Chilkat.Global.KeepBinaryResult is set to 1. This provides a means for obtaining large varbinary results in the SQL Server environment (where limitations exist in getting large amounts of data returned by method calls, but where temp tables can be used for binary properties).

LastErrorHtml As String (read-only)

Provides information in HTML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

LastErrorText As String (read-only)

Provides information in plain-text format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

Concept of LastErrorText

LastErrorText Standard Information

LastErrorXml As String (read-only)

Provides information in XML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

LastMethodSuccess As Long

Introduced in version 9.5.0.52

Indicate whether the last method call succeeded or failed. A value of 1 indicates success, a value of 0 indicates failure. This property is automatically set for method calls. It is not modified by property accesses. The property is automatically set to indicate success for the following types of method calls:

  • Any method that returns a string.
  • Any method returning a Chilkat object, binary bytes, or a date/time.
  • Any method returning a standard boolean status value where success = 1 and failure = 0.
  • Any method returning an integer where failure is defined by a return value less than zero.

Note: Methods that do not fit the above requirements will always set this property equal to 1. For example, a method that returns no value (such as a "void" in C++) will technically always succeed.

LastStringResult As String (read-only)

Introduced in version 9.5.0.52

The string return value of the last (string returning) method called. Only available if Chilkat.Global.KeepStringResult is set to 1. This provides a means for obtaining large string results in the SQL Server environment (where limitations exist in getting long strings returned by method calls, but where temp tables can be used for string properties).

Long Strings Returned by ActiveX Methods in SQL Server

LastStringResultLen As Long (read-only)

Introduced in version 9.5.0.53

The length, in characters, of the string contained in the LastStringResult property.

LittleEndian As Long

The default value is 0, which means that signatures and encrypted output will be created using the big endian byte ordering. A value of 1 will produce little-endian output, which is what Microsoft's Crypto API produces.

Important: Prior to v9.5.0.49, this property behaved the opposite as it should for encryption. When updating from an older version of Chilkat to v9.5.0.49 or greater, the following change is required:

  • If the application did NOT explicity set the LittleEndian property, then no change is required for encryption/decryption. If signatures were being created or verified, then explicitly set this property to 1.
  • If the application explicitly set this property, then reverse the setting ONLY if doing encryption/decryption. No changes are required if doing signature creation/verification.

NoUnpad As Long

If 1, skips unpadding when decrypting. The default is 0. This property value is typically left unchanged.

NumBits As Long (read-only)

The number of bits of the key generated or imported into this RSA encryption object. Keys ranging in size from 384 bits to 4096 bits can be generated by calling GenerateKey. A public or private key may be imported by calling ImportPublicKey or ImportPrivateKey. A key must be available either via GenerateKey or import before any of the encrypt/decrypt methods may be called.

OaepHash As String

Introduced in version 9.5.0.48

Selects the hash algorithm for use within OAEP padding. The valid choices are "sha1", "sha256", "sha384", "sha512", "md2", "md5", "haval", "ripemd128", "ripemd160","ripemd256", or "ripemd320". The default is "sha1".

OaepMgfHash As String

Introduced in version 9.5.0.71

Selects the MGF (mask generation) hash algorithm for use within OAEP padding. The valid choices are "sha1", "sha256", "sha384", "sha512", "md2", "md5", "haval", "ripemd128", "ripemd160","ripemd256", or "ripemd320". The default is "sha1".

OaepPadding As Long

Controls whether Optimal Asymmetric Encryption Padding (OAEP) is used for the padding scheme (for encrypting/decrypting). If set to 0, PKCS1 v1.5 padding is used. If set to 1, PKCS1 v2.0 (OAEP) padding is used.

Important: The OAEP padding algorithm uses randomly generated bytes. Therefore, the RSA result will be different each time, even if all of the other inputs are identical. For example, if you RSA encrypt or sign the same data using the same key 100 times, the output will appear different each time, but they are all valid.

When creating digital signatures, this property controls whether RSA-PSS or PKCS1 v1.5 is used. If 1, then the RSA-PSS signature scheme is used. The default value of this property is 0.

(Classic ASP) RSA OAEP Padding

(Visual FoxPro) RSA OAEP Padding

(PowerBuilder) RSA OAEP Padding

(SQL Server) RSA OAEP Padding

(Visual Basic 6.0) RSA OAEP Padding

(VBScript) RSA OAEP Padding

VerboseLogging As Long

If set to 1, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is 0. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.

Version As String (read-only)

Version of the component/library, such as "9.5.0.63"

Methods

DecryptBytes(inData As Variant, ByVal usePrivateKey As Long) As Variant

Decrypts byte data using the RSA encryption algorithm. usePrivateKey should be set to 1 if the private key is to be used for decrypting. Otherwise it should be set to 0 if the public key is to be used for decrypting.

Important: If trying to match OpenSSL results, set the LittleEndian property = 0.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

DecryptBytesENC(str As String, ByVal bUsePrivateKey As Long) As Variant

Same as DecryptBytes, except the input is an encoded string. The encoding is specified by the EncodingMode property, which can have values such as "base64", "hex", "quoted-printable", "url", etc.

Important: If trying to match OpenSSL results, set the LittleEndian property = 0.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

DecryptString(binarySig As Variant, ByVal usePrivateKey As Long) As String

Decrypts encrypted string data and returns an unencrypted string. usePrivateKey should be set to 1 if the private key is to be used for decrypting. Otherwise it should be set to 0 if the public key is to be used. The Charset property controls how the component interprets the decrypted string. Depending on the programming language, strings are returned to the application as Unicode, utf-8, or ANSI. Internal to DecryptString, the decrypted string is automatically converted from the charset specified by the Charset property to the encoding required by the calling programming language.

Important: If trying to match OpenSSL results, set the LittleEndian property = 0.

Returns Nothing on failure

DecryptStringENC(encodedSig As String, ByVal usePrivateKey As Long) As String

Same as DecryptString, except the input is an encoded string. The encoding is specified by the EncodingMode property, which can have values such as "base64", "hex", "quoted-printable", "url", etc.

Important: If trying to match OpenSSL results, set the LittleEndian property = 0.

Returns Nothing on failure

(Classic ASP) RSA Encrypt and Decrypt Strings

(Visual FoxPro) RSA Encrypt and Decrypt Strings

(PowerBuilder) RSA Encrypt and Decrypt Strings

(SQL Server) RSA Encrypt and Decrypt Strings

(Visual Basic 6.0) RSA Encrypt and Decrypt Strings

(VBScript) RSA Encrypt and Decrypt Strings

(Classic ASP) RSA Encryption -- Same Key Different Results

(Visual FoxPro) RSA Encryption -- Same Key Different Results

(PowerBuilder) RSA Encryption -- Same Key Different Results

(SQL Server) RSA Encryption -- Same Key Different Results

(Visual Basic 6.0) RSA Encryption -- Same Key Different Results

(VBScript) RSA Encryption -- Same Key Different Results

(Classic ASP) RSA Encrypting Symmetric Secret Key

(Visual FoxPro) RSA Encrypting Symmetric Secret Key

(PowerBuilder) RSA Encrypting Symmetric Secret Key

(SQL Server) RSA Encrypting Symmetric Secret Key

(Visual Basic 6.0) RSA Encrypting Symmetric Secret Key

(VBScript) RSA Encrypting Symmetric Secret Key

(Classic ASP) RSA Encrypt/Decrypt AES Key

(Visual FoxPro) RSA Encrypt/Decrypt AES Key

(PowerBuilder) RSA Encrypt/Decrypt AES Key

(SQL Server) RSA Encrypt/Decrypt AES Key

(Visual Basic 6.0) RSA Encrypt/Decrypt AES Key

(VBScript) RSA Encrypt/Decrypt AES Key

EncryptBytes(binaryData As Variant, ByVal usePrivateKey As Long) As Variant

Encrypts byte data using the RSA encryption algorithm. usePrivateKey should be set to 1 if the private key is to be used for encrypting. Otherwise it should be set to 0 if the public key is to be used for encrypting.

Important: If trying to match OpenSSL results, set the LittleEndian property = 0.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

EncryptBytesENC(data As Variant, ByVal bUsePrivateKey As Long) As String

Same as EncryptBytes, except the output is an encoded string. The encoding is specified by the EncodingMode property, which can have values such as "base64", "hex", "quoted-printable", "url", etc.

Important: If trying to match OpenSSL results, set the LittleEndian property = 0.

Returns Nothing on failure

(Classic ASP) RSA Encrypt with SHA-256 hash function and SHA-1 mask function

(Visual FoxPro) RSA Encrypt with SHA-256 hash function and SHA-1 mask function

(PowerBuilder) RSA Encrypt with SHA-256 hash function and SHA-1 mask function

(SQL Server) RSA Encrypt with SHA-256 hash function and SHA-1 mask function

(Visual Basic 6.0) RSA Encrypt with SHA-256 hash function and SHA-1 mask function

(VBScript) RSA Encrypt with SHA-256 hash function and SHA-1 mask function

EncryptString(stringToEncrypt As String, ByVal usePrivateKey As Long) As Variant

Encrypts a string using the RSA encryption algorithm. usePrivateKey should be set to 1 if the private key is to be used for encrypting. Otherwise it should be set to 0 if the public key is to be used for encrypting. The string is first converted (if necessary) to the character encoding specified by the Charset property before encrypting. The encrypted bytes are returned.

Important: If trying to match OpenSSL results, set the LittleEndian property = 0.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

(Classic ASP) Encrypt with Chilkat, Decrypt with OpenSSL

(Visual FoxPro) Encrypt with Chilkat, Decrypt with OpenSSL

(PowerBuilder) Encrypt with Chilkat, Decrypt with OpenSSL

(SQL Server) Encrypt with Chilkat, Decrypt with OpenSSL

(Visual Basic 6.0) Encrypt with Chilkat, Decrypt with OpenSSL

(VBScript) Encrypt with Chilkat, Decrypt with OpenSSL

EncryptStringENC(str As String, ByVal bUsePrivateKey As Long) As String

Same as EncryptString, except the output is an encoded string. The encoding is specified by the EncodingMode property, which can have values such as "base64", "hex", "quoted-printable", "url", etc.

Important: If trying to match OpenSSL results, set the LittleEndian property = 0.

Returns Nothing on failure

(Classic ASP) RSA Encrypt and Decrypt Strings

(Visual FoxPro) RSA Encrypt and Decrypt Strings

(PowerBuilder) RSA Encrypt and Decrypt Strings

(SQL Server) RSA Encrypt and Decrypt Strings

(Visual Basic 6.0) RSA Encrypt and Decrypt Strings

(VBScript) RSA Encrypt and Decrypt Strings

(Classic ASP) RSA Encryption -- Same Key Different Results

(Visual FoxPro) RSA Encryption -- Same Key Different Results

(PowerBuilder) RSA Encryption -- Same Key Different Results

(SQL Server) RSA Encryption -- Same Key Different Results

(Visual Basic 6.0) RSA Encryption -- Same Key Different Results

(VBScript) RSA Encryption -- Same Key Different Results

(Classic ASP) RSA Encrypting Symmetric Secret Key

(Visual FoxPro) RSA Encrypting Symmetric Secret Key

(PowerBuilder) RSA Encrypting Symmetric Secret Key

(SQL Server) RSA Encrypting Symmetric Secret Key

(Visual Basic 6.0) RSA Encrypting Symmetric Secret Key

(VBScript) RSA Encrypting Symmetric Secret Key

(Classic ASP) RSA Encrypt/Decrypt AES Key

(Visual FoxPro) RSA Encrypt/Decrypt AES Key

(PowerBuilder) RSA Encrypt/Decrypt AES Key

(SQL Server) RSA Encrypt/Decrypt AES Key

(Visual Basic 6.0) RSA Encrypt/Decrypt AES Key

(VBScript) RSA Encrypt/Decrypt AES Key

ExportPrivateKey() As String

Exports the private-key of an RSA key pair to XML format. This is typically called after generating a new RSA key via the GenerateKey method.

Returns Nothing on failure

ExportPrivateKeyObj() As PrivateKey

Introduced in version 9.5.0.40

Exports the private-key to a private key object. This is typically called after generating a new RSA key via the GenerateKey method. Once the private key object is obtained, it may be saved in a variety of different formats.

Returns Nothing on failure

(Classic ASP) Generate RSA Key and Export to PKCS1 / PKCS8

(Visual FoxPro) Generate RSA Key and Export to PKCS1 / PKCS8

(PowerBuilder) Generate RSA Key and Export to PKCS1 / PKCS8

(SQL Server) Generate RSA Key and Export to PKCS1 / PKCS8

(Visual Basic 6.0) Generate RSA Key and Export to PKCS1 / PKCS8

(VBScript) Generate RSA Key and Export to PKCS1 / PKCS8

ExportPublicKey() As String

Exports the public-key of an RSA key pair to XML format. This is typically called after generating a new RSA key via the GenerateKey method.

Returns Nothing on failure

ExportPublicKeyObj() As PublicKey

Introduced in version 9.5.0.40

Exports the public key to a public key object. Once the public key object is obtained, it may be saved in a variety of different formats.

Returns Nothing on failure

(Classic ASP) Generate RSA Key and Export to PKCS1 / PKCS8

(Visual FoxPro) Generate RSA Key and Export to PKCS1 / PKCS8

(PowerBuilder) Generate RSA Key and Export to PKCS1 / PKCS8

(SQL Server) Generate RSA Key and Export to PKCS1 / PKCS8

(Visual Basic 6.0) Generate RSA Key and Export to PKCS1 / PKCS8

(VBScript) Generate RSA Key and Export to PKCS1 / PKCS8

GenerateKey(ByVal numBits As Long) As Long

Generates a new RSA public/private key pair. The number of bits can range from 512 to 8192. Typical key lengths are 1024, 2048, or 4096 bits. After successful generation, the public/private parts of the key can be exported to XML via the ExportPrivateKey and ExportPublicKey methods.

Note: Prior to version 9.5.0.49, the max key size was 4096 bits. Generating an 8192-bit RSA key takes a considerable amount of time and CPU processing power. There are no event callbacks or progress monitoring for RSA key generation. Calling this will block the thread until it returns.

Returns 1 for success, 0 for failure.

(Classic ASP) Generate RSA Public/Private Key

(Visual FoxPro) Generate RSA Public/Private Key

(PowerBuilder) Generate RSA Public/Private Key

(SQL Server) Generate RSA Public/Private Key

(Visual Basic 6.0) Generate RSA Public/Private Key

(VBScript) Generate RSA Public/Private Key

ImportPrivateKey(xmlKey As String) As Long

Imports a private key from XML format. After successful import, the private key can be used to encrypt or decrypt. A private key (by definition) contains both private and public parts. This is because the public key consist of modulus and exponent. The private key consists of modulus, exponent, P, Q, DP, DQ, InverseQ, and D using base64 representation:

<RSAKeyValue>
  <Modulus>...</Modulus>
  <Exponent>...</Exponent>
  <P>...</P>
  <Q>...</Q>
  <DP>...</DP>
  <DQ>...</DQ>
  <InverseQ>...</InverseQ>
  <D>...</D>
</RSAKeyValue>

Important: The Rsa object can contain either a private key or a public key, but not both. Importing a private key overwrites the existing key regardless of whether the type of key is public or private.

Returns 1 for success, 0 for failure.

(Classic ASP) RSA Signature with Certificate's Private Key from PFX

(Visual FoxPro) RSA Signature with Certificate's Private Key from PFX

(PowerBuilder) RSA Signature with Certificate's Private Key from PFX

(SQL Server) RSA Signature with Certificate's Private Key from PFX

(Visual Basic 6.0) RSA Signature with Certificate's Private Key from PFX

(VBScript) RSA Signature with Certificate's Private Key from PFX

(Classic ASP) Load PEM Public/Private Key into RSA Object

(Visual FoxPro) Load PEM Public/Private Key into RSA Object

(PowerBuilder) Load PEM Public/Private Key into RSA Object

(SQL Server) Load PEM Public/Private Key into RSA Object

(Visual Basic 6.0) Load PEM Public/Private Key into RSA Object

(VBScript) Load PEM Public/Private Key into RSA Object

ImportPrivateKeyObj(key As PrivateKey) As Long

Introduced in version 9.5.0.40

Imports a private key from a private key object. The imported private key is used in methods that sign or decrypt.

Returns 1 for success, 0 for failure.

(Classic ASP) RSA Sign Using Private Key from .pfx/.p12 to Base64 Signature

(Visual FoxPro) RSA Sign Using Private Key from .pfx/.p12 to Base64 Signature

(PowerBuilder) RSA Sign Using Private Key from .pfx/.p12 to Base64 Signature

(SQL Server) RSA Sign Using Private Key from .pfx/.p12 to Base64 Signature

(Visual Basic 6.0) RSA Sign Using Private Key from .pfx/.p12 to Base64 Signature

(VBScript) RSA Sign Using Private Key from .pfx/.p12 to Base64 Signature

ImportPublicKey(xmlKey As String) As Long

Imports a public key from XML format. After successful import, the public key can be used to encrypt or decrypt.

Note: Importing a public key overwrites the key that is currently contained in this object - even if it's a private key.

A public key consists of modulus and exponent using base64 representation:

<RSAKeyValue>
  <Modulus>...</Modulus>
  <Exponent>...</Exponent>
</RSAKeyValue>

Important: The Rsa object can contain either a private key or a public key, but not both. Importing a private key overwrites the existing key regardless of whether the type of key is public or private.

Returns 1 for success, 0 for failure.

(Classic ASP) RSA Encrypt with Modulus and Exponent

(Visual FoxPro) RSA Encrypt with Modulus and Exponent

(PowerBuilder) RSA Encrypt with Modulus and Exponent

(SQL Server) RSA Encrypt with Modulus and Exponent

(Visual Basic 6.0) RSA Encrypt with Modulus and Exponent

(VBScript) RSA Encrypt with Modulus and Exponent

(Classic ASP) RSA Signature/Verify with .key and .cer

(Visual FoxPro) RSA Signature/Verify with .key and .cer

(PowerBuilder) RSA Signature/Verify with .key and .cer

(SQL Server) RSA Signature/Verify with .key and .cer

(Visual Basic 6.0) RSA Signature/Verify with .key and .cer

(VBScript) RSA Signature/Verify with .key and .cer

(Classic ASP) Load PEM Public/Private Key into RSA Object

(Visual FoxPro) Load PEM Public/Private Key into RSA Object

(PowerBuilder) Load PEM Public/Private Key into RSA Object

(SQL Server) Load PEM Public/Private Key into RSA Object

(Visual Basic 6.0) Load PEM Public/Private Key into RSA Object

(VBScript) Load PEM Public/Private Key into RSA Object

ImportPublicKeyObj(key As PublicKey) As Long

Introduced in version 9.5.0.40

Imports a public key from a public key object. The imported public key is used in methods that encrypt data or verify signatures.

Returns 1 for success, 0 for failure.

(Classic ASP) Encrypt with Chilkat, Decrypt with OpenSSL

(Visual FoxPro) Encrypt with Chilkat, Decrypt with OpenSSL

(PowerBuilder) Encrypt with Chilkat, Decrypt with OpenSSL

(SQL Server) Encrypt with Chilkat, Decrypt with OpenSSL

(Visual Basic 6.0) Encrypt with Chilkat, Decrypt with OpenSSL

(VBScript) Encrypt with Chilkat, Decrypt with OpenSSL

OpenSslSignBytes(data As Variant) As Variant

Duplicates OpenSSL's rsautl utility for creating RSA signatures. Input data consists of binary bytes, and returns the signature bytes.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

(Classic ASP) Duplicating OpenSSL rsautl (creating RSA signatures)

(Visual FoxPro) Duplicating OpenSSL rsautl (creating RSA signatures)

(PowerBuilder) Duplicating OpenSSL rsautl (creating RSA signatures)

(SQL Server) Duplicating OpenSSL rsautl (creating RSA signatures)

(Visual Basic 6.0) Duplicating OpenSSL rsautl (creating RSA signatures)

(VBScript) Duplicating OpenSSL rsautl (creating RSA signatures)

OpenSslSignBytesENC(data As Variant) As String

Duplicates OpenSSL's rsautl utility for creating RSA signatures. Input data consists of binary bytes, and returns the signature as a string encoded according to the EncodingMode property (base64, hex, etc.).

Returns Nothing on failure

OpenSslSignString(str As String) As Variant

Duplicates OpenSSL's rsautl utility for creating RSA signatures. Input data is a string, and returns the signature bytes.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

OpenSslSignStringENC(str As String) As String

Duplicates OpenSSL's rsautl utility for creating RSA signatures. Input data is a string, and returns the signature as a string encoded according to the EncodingMode property (base64, hex, etc.).

Returns Nothing on failure

(Classic ASP) Duplicating OpenSSL rsautl (creating RSA signatures)

(Visual FoxPro) Duplicating OpenSSL rsautl (creating RSA signatures)

(PowerBuilder) Duplicating OpenSSL rsautl (creating RSA signatures)

(SQL Server) Duplicating OpenSSL rsautl (creating RSA signatures)

(Visual Basic 6.0) Duplicating OpenSSL rsautl (creating RSA signatures)

(VBScript) Duplicating OpenSSL rsautl (creating RSA signatures)

OpenSslVerifyBytes(signature As Variant) As Variant

Duplicates OpenSSL's rsautl utility for verifying RSA signatures and recovering the original data. Input data consists of the raw signature bytes and returns the original bytes.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

(Classic ASP) Duplicating OpenSSL rsautl (creating RSA signatures)

(Visual FoxPro) Duplicating OpenSSL rsautl (creating RSA signatures)

(PowerBuilder) Duplicating OpenSSL rsautl (creating RSA signatures)

(SQL Server) Duplicating OpenSSL rsautl (creating RSA signatures)

(Visual Basic 6.0) Duplicating OpenSSL rsautl (creating RSA signatures)

(VBScript) Duplicating OpenSSL rsautl (creating RSA signatures)

OpenSslVerifyBytesENC(str As String) As Variant

Duplicates OpenSSL's rsautl utility for verifying RSA signatures and recovering the original data. Input data is a signature string encoded according to the EncodingMode property (base64, hex, etc.). Returns the original bytes.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

OpenSslVerifyString(data As Variant) As String

Duplicates OpenSSL's rsautl utility for verifying RSA signatures and recovering the original data. Input data consists of the raw signature bytes and returns the original string.

Returns Nothing on failure

OpenSslVerifyStringENC(str As String) As String

Duplicates OpenSSL's rsautl utility for verifying RSA signatures and recovering the original data. Input data is a signature string encoded according to the EncodingMode property (base64, hex, etc.). Returns the original string.

Returns Nothing on failure

(Classic ASP) Duplicating OpenSSL rsautl (creating RSA signatures)

(Visual FoxPro) Duplicating OpenSSL rsautl (creating RSA signatures)

(PowerBuilder) Duplicating OpenSSL rsautl (creating RSA signatures)

(SQL Server) Duplicating OpenSSL rsautl (creating RSA signatures)

(Visual Basic 6.0) Duplicating OpenSSL rsautl (creating RSA signatures)

(VBScript) Duplicating OpenSSL rsautl (creating RSA signatures)

SignBytes(binaryData As Variant, hashAlgorithm As String) As Variant

Creates an RSA digital signature by hashing binaryData and then signing the hash. The hash algorithm is specified by hashAlgorithm, which may be "SHA-1", "MD5", "MD2", "SHA-256", "SHA-384", or "SHA-512". The recommended hash algorithm is "SHA-1".

Important: If trying to match OpenSSL results, set the LittleEndian property = 0. (The LittleEndian property should also be set to 0 to match Amazon web services, such as CloudFront.)

A private key is required to create a digital signature.

An error is indicated when a byte array of 0 length is returned.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

SignBytesENC(binaryData As Variant, hashAlgorithm As String) As String

Creates an RSA digital signature by hashing binaryData and then signing the hash. The hash algorithm is specified by hashAlgorithm, which may be "SHA-1", "MD5", "MD2", "SHA-256", "SHA-384", or "SHA-512". The recommended hash algorithm is "SHA-1". The digital signature is returned as an encoded string, where the encoding is specified by the EncodingMode property.

Important: If trying to match OpenSSL results, set the LittleEndian property = 0. (The LittleEndian property should also be set to 0 to match Amazon web services, such as CloudFront.)

A private key is required to create a digital signature.

An error is indicated when null reference is returned.

Returns Nothing on failure

SignHash(hashBytes As Variant, hashAlg As String) As Variant

The same as the SignBytes method, except the hash to be signed is passed directly.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

SignHashENC(encodedHash As String, hashAlg As String) As String

The same as SignBytesENC except the hash is passed directly.

Returns Nothing on failure

SignString(strToBeHashed As String, hashAlgorithm As String) As Variant

Creates an RSA digital signature by hashing strToBeHashed and then signing the hash. The hash algorithm is specified by hashAlgorithm, which may be "SHA-1", "MD5", "MD2", "SHA-256", "SHA-384", or "SHA-512". The recommended hash algorithm is "SHA-1".

Important: If trying to match OpenSSL results, set the LittleEndian property = 0. (The LittleEndian property should also be set to 0 to match Amazon web services, such as CloudFront.)

A private key is required to create a digital signature.

An error is indicated when a byte array of 0 length is returned.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

(Classic ASP) RSA SHA256 Signature using Private Key from Java Keystore

(Visual FoxPro) RSA SHA256 Signature using Private Key from Java Keystore

(PowerBuilder) RSA SHA256 Signature using Private Key from Java Keystore

(SQL Server) RSA SHA256 Signature using Private Key from Java Keystore

(Visual Basic 6.0) RSA SHA256 Signature using Private Key from Java Keystore

(VBScript) RSA SHA256 Signature using Private Key from Java Keystore

SignStringENC(strToBeHashed As String, hashAlgorithm As String) As String

Creates an RSA digital signature by hashing strToBeHashed and then signing the hash. The hash algorithm is specified by hashAlgorithm, which may be "SHA-1", "MD5", "MD2", "SHA-256", "SHA-384", or "SHA-512". The recommended hash algorithm is "SHA-1". The digital signature is returned as an encoded string, where the encoding is specified by the EncodingMode property.

Important: If trying to match OpenSSL results, set the LittleEndian property = 0. (The LittleEndian property should also be set to 0 to match Amazon web services, such as CloudFront.)

A private key is required to create a digital signature.

An error is indicated when null reference is returned.

Returns Nothing on failure

(Classic ASP) Example Code: Create RSA Signature with PEM Private Key

(Visual FoxPro) Example Code: Create RSA Signature with PEM Private Key

(PowerBuilder) Example Code: Create RSA Signature with PEM Private Key

(SQL Server) Example Code: Create RSA Signature with PEM Private Key

(Visual Basic 6.0) Example Code: Create RSA Signature with PEM Private Key

(VBScript) Example Code: Create RSA Signature with PEM Private Key

(Classic ASP) Duplicate openssl dgst -md5 -sign myKey.pem something.txt | openssl enc -base64 -A

(Visual FoxPro) Duplicate openssl dgst -md5 -sign myKey.pem something.txt | openssl enc -base64 -A

(PowerBuilder) Duplicate openssl dgst -md5 -sign myKey.pem something.txt | openssl enc -base64 -A

(SQL Server) Duplicate openssl dgst -md5 -sign myKey.pem something.txt | openssl enc -base64 -A

(Visual Basic 6.0) Duplicate openssl dgst -md5 -sign myKey.pem something.txt | openssl enc -base64 -A

(VBScript) Duplicate openssl dgst -md5 -sign myKey.pem something.txt | openssl enc -base64 -A

(Classic ASP) RSA Sign Using Private Key from .pfx/.p12 to Base64 Signature

(Visual FoxPro) RSA Sign Using Private Key from .pfx/.p12 to Base64 Signature

(PowerBuilder) RSA Sign Using Private Key from .pfx/.p12 to Base64 Signature

(SQL Server) RSA Sign Using Private Key from .pfx/.p12 to Base64 Signature

(Visual Basic 6.0) RSA Sign Using Private Key from .pfx/.p12 to Base64 Signature

(VBScript) RSA Sign Using Private Key from .pfx/.p12 to Base64 Signature

(Classic ASP) Walmart Partner API Authentication (Generate a Signature for a Request)

(Visual FoxPro) Walmart Partner API Authentication (Generate a Signature for a Request)

(PowerBuilder) Walmart Partner API Authentication (Generate a Signature for a Request)

(SQL Server) Walmart Partner API Authentication (Generate a Signature for a Request)

(Visual Basic 6.0) Walmart Partner API Authentication (Generate a Signature for a Request)

(VBScript) Walmart Partner API Authentication (Generate a Signature for a Request)

SnkToXml(filename As String) As String

Imports a .snk file to an XML document that can be imported via the ImportPrivateKey method.

Returns Nothing on failure

UnlockComponent(unlockCode As String) As Long

Unlocks the component. This must be called once prior to calling any other method.

Returns 1 for success, 0 for failure.

Diagnosing UnlockComponent Problems

UnlockComponent LastErrorText shows exact string passed to it.

Verify UnlockComponent Success w/ Purchased Unlock Code

LastErrorText Standard Information

VerifyBytes(originalData As Variant, hashAlgorithm As String, signatureBytes As Variant) As Long

Verifies an RSA digital signature. Returns 1 if the signature is valid for the originalData. The hashAlgorithm may be "SHA-1", "MD5", "MD2", "SHA-256", "SHA-384", or "SHA-512". The recommended hash algorithm is "SHA-1".

VerifyBytesENC(originalData As Variant, hashAlgorithm As String, encodedSig As String) As Long

Verifies an RSA digital signature. Returns 1 if the signature is valid for the originalData. The hashAlgorithm may be "SHA-1", "MD5", "MD2", "SHA-256", "SHA-384", or "SHA-512". The recommended hash algorithm is "SHA-1".

The encodedSig is a digital signature encoded according to the EncodingMode property (i.e. base64, hex, etc.).

VerifyHash(hashBytes As Variant, hashAlg As String, sigBytes As Variant) As Long

The same as VerifyBytes except the hash of the original data is passed directly.

VerifyHashENC(encodedHash As String, hashAlg As String, encodedSig As String) As Long

The same as VerifyBytesENC except the hash of the original data is passed directly.

VerifyPrivateKey(xml As String) As Long

Returns 1 if the XML contains a valid RSA private key. Otherwise returns 0.

Returns 1 for success, 0 for failure.

VerifyString(originalString As String, hashAlgorithm As String, binarySig As Variant) As Long

Verifies an RSA digital signature. Returns 1 if the signature is valid for the originalString. The hashAlgorithm may be "SHA-1", "MD5", "MD2", "SHA-256", "SHA-384", or "SHA-512". The recommended hash algorithm is "SHA-1".

VerifyStringENC(originalString As String, hashAlgorithm As String, encodedSig As String) As Long

Verifies an RSA digital signature. Returns 1 if the signature is valid for the originalString. The hashAlgorithm may be "SHA-1", "MD5", "MD2", "SHA-256", "SHA-384", or "SHA-512". The recommended hash algorithm is "SHA-1".

The encodedSig is a digital signature encoded according to the EncodingMode property (i.e. base64, hex, etc.).