EdDSA SQL Server Reference Documentation
EdDSA
Current Version: 11.6.0
Chilkat.EdDSA
Create Ed25519 private keys for signing, verification, and compatible
key-agreement workflows.
Sign binary data directly from a
Verify encoded EdDSA signatures using the corresponding public key and
the original message data.
Use Ed25519, Ed25519ph, or Ed25519ctx depending on the protocol or
interoperability requirements.
Supply optional context bytes as a hex string for workflows that use the
Ed25519ctx or related context-aware signing modes.
Compute encoded shared secrets from compatible private and public key
pairs for protocols that require this operation.
For an extended overview, see
EdDSA Class Overview.
Generate Ed25519 keys, sign data, verify signatures, and compute shared secrets.
Chilkat.EdDSA is the Chilkat class for Ed25519-based EdDSA
operations. It can generate Ed25519 private keys, sign data contained in
BinData, verify encoded signatures with public keys, and compute
encoded shared secrets from compatible private/public key pairs. It supports
the Ed25519, Ed25519ph, and Ed25519ctx variants, with optional context bytes
supplied as a hex string when the selected variant requires them.
Generate Ed25519 keys
Sign BinData
Chilkat.BinData object
using an Ed25519 private key.
Verify signatures
Ed25519 variants
Context support
Shared-secret output
BinData
content. For shared-secret workflows, compute the encoded secret and pass it
through the key derivation or formatting step required by the protocol.
Object Creation
DECLARE @hr int
DECLARE @edDSA int
EXEC @hr = sp_OACreate 'Chilkat.EdDSA', @edDSA OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
-- ... use @edDSA ...
EXEC @hr = sp_OADestroy @edDSAT-SQL uses the Chilkat ActiveX through the OLE Automation stored procedures. They must be enabled once on the server (EXEC sp_configure 'Ole Automation Procedures', 1; RECONFIGURE;), and the Chilkat ActiveX registered must match the bitness of the SQL Server instance (64-bit for a 64-bit SQL Server). To bind to a specific major version of Chilkat, append the major version number to the ProgID, such as sp_OACreate 'Chilkat.EdDSA.11' for Chilkat v11.*.*.
sp_OACreate returns an object token (an int) that is passed as the first argument of every sp_OAMethod, sp_OAGetProperty and sp_OASetProperty call, and released with sp_OADestroy. Objects returned by methods (such as an HttpResponse or JsonObject) are also tokens received through an int OUT parameter; they must likewise be destroyed, and the OUT parameter is NULL when the method fails to return an object. Objects passed as arguments are passed by their token. When an OLE Automation procedure itself fails (non-zero @hr), sp_OAGetErrorInfo describes the error.
Data types: strings are nvarchar(4000); integers, booleans (1 or 0) and object tokens are int; dates are datetime. In the signatures on this page, @success, @iResult, @sResult and the like are the OUT variables receiving a method's return value, @iValue / @sValue receive or supply a property value, and the remaining @ variables are the method's arguments in order.
A string returned through an OUT parameter is limited to 4000 characters. For longer values, retrieve the result as a result set into a table variable instead of an OUT parameter, for example DECLARE @tmp TABLE (outputLine ntext) followed by INSERT INTO @tmp EXEC sp_OAGetProperty @edDSA, 'LastErrorText'. See string length limitations for strings returned by sp_OAMethod calls.
Methods that pass or return raw byte arrays are not shown on this page, because varbinary(max) values cannot be exchanged through sp_OAMethod (see varbinary(max) limitation). Use the BinData-based alternatives (methods ending in Bd) or the base64 / hex string-encoded variants instead. Binary properties (such as LastBinaryResult) can be retrieved as a result set into a table variable, as shown in their signatures. Asynchronous (*Async) methods and event callbacks are not available from SQL Server.
Properties
Algorithm
EXEC sp_OASetProperty @edDSA, 'Algorithm', @sValue
Selects the Ed25519 signature variant used by SignBdENC and VerifyBdENC. The default is Ed25519.
| Value | Behavior | Context |
|---|---|---|
Ed25519 | The standard pure Ed25519 signature scheme. The complete message is signed directly by the Ed25519 algorithm. | A context is not part of this variant and should be empty. |
Ed25519ctx | Pure Ed25519 with domain separation supplied by a context string. | The context should normally be nonempty and must match exactly during verification. |
Ed25519ph | Prehash Ed25519. Chilkat first hashes the message with SHA-512 as defined for this variant. | May be empty or contain up to 255 context bytes; it must match exactly during verification. |
GenEd25519Key and does not affect SharedSecretENC.Context
EXEC sp_OASetProperty @edDSA, 'Context', @sValue
Gets or sets the context bytes used by the Ed25519ctx and Ed25519ph signature variants. Supply the bytes as a hexadecimal string. The default is an empty string.
A context may contain at most 255 bytes, which corresponds to at most 510 hexadecimal characters. The same context bytes must be supplied byte-for-byte when verifying the signature. An invalid hexadecimal value or an oversized context causes the signing or verification operation to fail.
Algorithm is Ed25519ctx or Ed25519ph. Standard Ed25519 does not include a context.DebugLogFilePath
EXEC sp_OASetProperty @edDSA, 'DebugLogFilePath', @sValue
If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. This logging helps identify the context and history of Chilkat calls leading up to any crash or hang, aiding in debugging.
Enabling the VerboseLogging property provides more detailed information. This property is mainly used for debugging rare instances where a Chilkat method call causes a hang or crash, which should generally not happen.
Possible causes of hangs include:
- A timeout property set to 0, indicating an infinite timeout.
- A hang occurring within an event callback in the application code.
- An internal bug in the Chilkat code causing the hang.
LastBinaryResult
This property is mainly used in SQL Server stored procedures to retrieve binary data from the last method call that returned binary data. It is only accessible if Chilkat.Global.KeepBinaryResult is set to 1. This feature allows for the retrieval of large varbinary results in an SQL Server environment, which has restrictions on returning large data via method calls, though temp tables can handle binary properties.
LastErrorHtml
Provides HTML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.
topLastErrorText
Provides plain text information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.
LastErrorXml
Provides XML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.
topLastMethodSuccess
EXEC sp_OASetProperty @edDSA, 'LastMethodSuccess', @iValue
Indicates the success or failure of the most recent method call: 1 means success, 0 means failure. This property remains unchanged by property setters or getters. This method is present to address challenges in checking for null or Nothing returns in certain programming languages. Note: This property does not apply to methods that return integer values or to boolean-returning methods where the boolean does not indicate success or failure.
LastStringResult
In SQL Server stored procedures, this property holds the string return value of the most recent method call that returns a string. It is accessible only when Chilkat.Global.KeepStringResult is set to TRUE. SQL Server has limitations on string lengths returned from methods and properties, but temp tables can be used to access large strings.
LastStringResultLen
The length, in characters, of the string contained in the LastStringResult property.
topVerboseLogging
EXEC sp_OASetProperty @edDSA, 'VerboseLogging', @iValue
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
Methods
GenEd25519Key
Generates a new Ed25519 key pair using prng as the source of cryptographically secure random bytes. On success, the generated private key and its corresponding public key are stored in the existing PrivateKey object passed in privKey.
Returns on success and 1 on failure. If the method fails, inspect 0LastErrorText for details.
Returns 1 for success, 0 for failure.
SharedSecretENC
Computes a 32-byte X25519 shared secret from the private key in privkey and the peer's public key in pubkey. The resulting bytes are returned as text using the binary encoding named by encoding, such as hex, hexlower, or base64.
Each participant supplies its own private key and the other participant's public key. When Alice computes the secret from Alice's private key and Bob's public key, and Bob computes it from Bob's private key and Alice's public key, both obtain the same result.
Algorithm and Context properties do not apply.This is a string-returning method. Check LastMethodSuccess before using the returned value; on failure, inspect LastErrorText.
Returns NULL on failure
SignBdENC
Creates an EdDSA signature over the exact byte sequence contained in bd, using the Ed25519 private key in privkey. The 64-byte signature is returned as text using the binary encoding named by encoding, such as hex, hexlower, or base64.
The selected Algorithm and Context properties determine whether the operation uses Ed25519, Ed25519ctx, or Ed25519ph. For Ed25519ph, pass the original message bytes in bd; Chilkat performs the required SHA-512 prehash as part of the Ed25519ph operation.
This is a string-returning method. Check LastMethodSuccess before using the returned value; on failure, inspect LastErrorText.
Returns NULL on failure
VerifyBdENC
Verifies the encoded EdDSA signature in encodedSig against the exact byte sequence contained in bd, using the Ed25519 public key in pubkey. enocding names the binary encoding of encodedSig, such as hex, hexlower, or base64.
The verifier must use the same Algorithm and Context values that were used to create the signature. Any change to the message, signature, public key, algorithm variant, or context causes verification to fail.
Returns only when the signature is valid. Returns 1 for an invalid signature or an operational error, such as malformed encoded input, an unsupported encoding, or an unsuitable key. Inspect 0LastErrorText for diagnostic information.
Returns 1 for success, 0 for failure.