Dsa Zig Reference Documentation

Dsa

Current Version: 11.6.1

Chilkat.Dsa

Generate, import, export, sign, and verify DSA keys and signatures.

Chilkat.Dsa is the Chilkat class for DSA key generation, DSA key import/export, DSA hash signing, and DSA signature verification. It supports private and public keys in DER, PEM, encrypted PEM, XML, explicit component, and OpenSSL parameter workflows. It also exposes DSA key components as hex-encoded SSH1-format bignums and provides helpers for working with encoded hashes and signatures.

Generate DSA keys

Create DSA key pairs and parameters for workflows that still require DSA-based signing or verification.

Import and export keys

Load and save private or public DSA keys in DER, PEM, encrypted PEM, XML, component-based, and OpenSSL-compatible formats.

Sign hashes

Create DSA signatures over message digests using a loaded private key and the appropriate encoded hash input.

Verify signatures

Verify DSA signatures using a public key, encoded hash, and signature data.

Key components

Access DSA parameters and key components as hex-encoded SSH1-format bignums for low-level interoperability scenarios.

Encoded data helpers

Work with encoded hashes and signatures when applications need hex, Base64, or other textual representations of binary values.

Common pattern: Load or generate a DSA key, compute the message hash with the desired hash algorithm, then use Dsa to sign the hash with the private key or verify the signature with the public key. For new protocol designs, consider whether a more modern signature algorithm is preferred; use this class when DSA is required for compatibility.

Object Creation

// Add the package once:
//     zig fetch --save https://chilkatdownload.com/11.6.1/chilkat-zig-11.6.1.tar.gz
// and in build.zig:
//     const chilkat = b.dependency("chilkat", .{ .target = target, .optimize = optimize });
//     exe.root_module.addImport("chilkat", chilkat.module("chilkat"));
const chilkat = @import("chilkat");

// Once per process, before any other Chilkat call:
try chilkat.unlockBundle("Anything for 30-day trial");

const dsa = try chilkat.Dsa.init();
defer dsa.deinit();
pub fn init() Allocator.Error!Dsa

Creates the underlying native Chilkat object. Dsa is a one-pointer struct passed by value; copying it copies the handle (two names for one object). Returns error.OutOfMemory if the library could not allocate the object. Use an object from one thread at a time; it may be handed from one thread to another.

pub fn deinit(self: Dsa) void

Releases the native object. Call it exactly once per object (usually with defer); the handle is invalid afterwards. Objects returned by methods are owned by the caller too and are released the same way.

pub fn fromHandle(h: *chilkat.c.CkDsa.HCkDsa) Dsa

Wraps a handle obtained from the C API (chilkat.c.CkDsa), taking ownership of it. The struct's handle field goes the other way, for anything the Zig API does not cover.

Errors and memory

Methods that can fail return an error union: a method whose only outcome is success or failure returns Error!void; a method producing a string returns (Error || Allocator.Error)![:0]u8; a method producing an object returns Error!T. chilkat.Error is error{ChilkatFailed}; the reason for a failure is in getLastErrorText, and the object remains usable. Properties never fail, and methods that answer a question (hasMember, isUnlocked, ...) return a plain bool.

String arguments are [:0]const u8 (UTF-8; string literals can be passed as is). String results are copies allocated with the allocator argument and owned by the caller, so they stay valid across later calls on the same object.

const text = dsa.someMethod(allocator, ...) catch |err| {
    const why = try dsa.getLastErrorText(allocator);
    defer allocator.free(why);
    std.debug.print("{s}\n", .{why});
    return err;
};
defer allocator.free(text);

Properties

DebugLogFilePath
// read/write
pub fn getDebugLogFilePath(self: Dsa, allocator: Allocator) Allocator.Error![:0]u8
pub fn setDebugLogFilePath(self: Dsa, value: [:0]const u8) void

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.

More Information and Examples
top
GroupSize
// read/write
pub fn getGroupSize(self: Dsa) i32
pub fn setGroupSize(self: Dsa, value: i32) void

Specifies the size, in bits, of the DSA subgroup parameter Q used by the legacy GenKey method. The default is 160. This also determines the natural size of the DSA signature components r and s.

Applications should normally leave this property at its default. When an explicit standards-era (L, N) parameter pair is required, use GenKey2, where L is the bit length of P and N is the bit length of Q.

Legacy algorithm: NIST FIPS 186-5 no longer approves DSA for generating new digital signatures. Retain DSA generation and signing only for interoperability with systems or data formats that specifically require it; DSA verification remains useful for legacy signatures.

top
HexG
// read-only
pub fn getHexG(self: Dsa, allocator: Allocator) Allocator.Error![:0]u8

Returns the DSA domain parameter G, the generator of the subgroup of order Q modulo P.

The returned text is a hexadecimal encoding of Chilkat's SSH1-format bignum representation, which includes a two-byte bit-length prefix followed by the unsigned integer bytes.

top
HexP
// read-only
pub fn getHexP(self: Dsa, allocator: Allocator) Allocator.Error![:0]u8

Returns the DSA domain parameter P, the large prime modulus.

The returned text is a hexadecimal encoding of Chilkat's SSH1-format bignum representation, which includes a two-byte bit-length prefix followed by the unsigned integer bytes.

top
HexQ
// read-only
pub fn getHexQ(self: Dsa, allocator: Allocator) Allocator.Error![:0]u8

Returns the DSA domain parameter Q, a prime divisor of P - 1. The bit length of Q is commonly written as N and determines the range of the private value X and signature components r and s.

The returned text is a hexadecimal encoding of Chilkat's SSH1-format bignum representation, which includes a two-byte bit-length prefix followed by the unsigned integer bytes.

top
HexX
// read-only
pub fn getHexX(self: Dsa, allocator: Allocator) Allocator.Error![:0]u8

Returns the DSA private value X. It is present only when the object contains a private key and satisfies 0 < X < Q.

The returned text is a hexadecimal encoding of Chilkat's SSH1-format bignum representation, which includes a two-byte bit-length prefix followed by the unsigned integer bytes.

Sensitive value: Anyone who obtains X can create signatures as the key owner. Do not log, transmit, or persist this value unless it is protected as private-key material.

top
HexY
// read-only
pub fn getHexY(self: Dsa, allocator: Allocator) Allocator.Error![:0]u8

Returns the DSA public value Y, where Y = GX mod P. It is available when either a public or private DSA key is loaded.

The returned text is a hexadecimal encoding of Chilkat's SSH1-format bignum representation, which includes a two-byte bit-length prefix followed by the unsigned integer bytes.

top
LastErrorHtml
// read-only
pub fn getLastErrorHtml(self: Dsa, allocator: Allocator) Allocator.Error![:0]u8

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.

top
LastErrorText
// read-only
pub fn getLastErrorText(self: Dsa, allocator: Allocator) Allocator.Error![:0]u8

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.

top
LastErrorXml
// read-only
pub fn getLastErrorXml(self: Dsa, allocator: Allocator) Allocator.Error![:0]u8

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.

top
LastMethodSuccess
// read/write
pub fn getLastMethodSuccess(self: Dsa) bool
pub fn setLastMethodSuccess(self: Dsa, value: bool) void

Indicates the success or failure of the most recent method call: true means success, false 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.

top
UncommonOptions
// read/write
pub fn getUncommonOptions(self: Dsa, allocator: Allocator) Allocator.Error![:0]u8
pub fn setUncommonOptions(self: Dsa, value: [:0]const u8) void
Introduced in version 9.5.0.90

Reserved for uncommon or compatibility-specific options. The default is the empty string, and applications should normally leave this property unchanged unless Chilkat documentation or support identifies a specific keyword required for the target system.

top
VerboseLogging
// read/write
pub fn getVerboseLogging(self: Dsa) bool
pub fn setVerboseLogging(self: Dsa, value: bool) void

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

top
Version
// read-only
pub fn getVersion(self: Dsa, allocator: Allocator) Allocator.Error![:0]u8

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

More Information and Examples
top

Methods

FromDerBd
pub fn fromDerBd(self: Dsa, bd: chilkat.BinData) Error!void
Introduced in version 11.0.0

Loads a DSA private key from the DER bytes contained in the BinData object passed in bd. Returns true on successful decoding.

Private-key handling: The BinData content contains secret key material and should be cleared or released when no longer needed.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
FromDerFile
pub fn fromDerFile(self: Dsa, path: [:0]const u8) Error!void

Loads a DSA private key from the DER-encoded file specified by path. Returns true when the file is read and decoded successfully; otherwise returns false.

Private-key handling: Restrict access to the file because it contains secret key material. Check LastErrorText when loading fails.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

More Information and Examples
top
FromEncryptedPem
pub fn fromEncryptedPem(self: Dsa, password: [:0]const u8, pem_data: [:0]const u8) Error!void

Loads a DSA private key from the PEM text in pem_data. password supplies the password when the PEM is encrypted. If the PEM is unencrypted, the password is ignored and the key is loaded normally.

Returns true on success and false if the PEM cannot be decoded, the password is incorrect, or the contained key is not a supported DSA private key.

Security: Do not embed production passwords in source code or log the PEM text. Prefer protected secret storage and encrypted private-key files where practical.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
FromPem
pub fn fromPem(self: Dsa, pem_data: [:0]const u8) Error!void

Loads an unencrypted DSA private key from the PEM text in pem_data. On success, the object contains the private key and its corresponding public components.

Unencrypted private key: PEM armor is only a text encoding; it does not protect the private key. Treat the string as highly sensitive and use FromEncryptedPem when password-protected PEM is available.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

More Information and Examples
top
FromPublicDerBd
pub fn fromPublicDerBd(self: Dsa, bd: chilkat.BinData) Error!void
Introduced in version 11.0.0

Loads a DSA public key from the DER bytes contained in the BinData object passed in bd. The resulting key can verify signatures but cannot sign.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
FromPublicDerFile
pub fn fromPublicDerFile(self: Dsa, path: [:0]const u8) Error!void

Loads a DSA public key from the DER-encoded file specified by path. Returns true when the file is read and decoded successfully; otherwise returns false.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
FromPublicPem
pub fn fromPublicPem(self: Dsa, pem_data: [:0]const u8) Error!void

Loads a DSA public key from the PEM text in pem_data. Returns true when the PEM contains a supported DSA public key and is decoded successfully.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
FromXml
pub fn fromXml(self: Dsa, xml_key: [:0]const u8) Error!void

Loads a DSA public or private key from the XML text in xml_key. The XML content determines whether the resulting object contains public components only or also includes the private value X.

Security: XML is only a representation format. If the XML contains X, it contains the complete private key and must be protected accordingly.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
GenKey
pub fn genKey(self: Dsa, num_bits: i32) Error!void

Generates a new DSA key pair with a P size of num_bits bits. num_bits must be at least 1024 and a multiple of 64. This legacy method uses the subgroup size selected by GroupSize, whose default is 160 bits.

For explicit standard parameter pairs such as (2048, 224) or (3072, 256), use GenKey2.

Legacy algorithm: DSA signature generation is no longer approved by FIPS 186-5. Generate new DSA keys only when required for compatibility with an existing protocol, key store, or signature format.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

More Information and Examples
top
GenKey2
pub fn genKey2(self: Dsa, key_len_bits: i32, mod_len_bits: i32) Error!void
Introduced in version 9.5.0.90

Generates a new DSA key pair using an explicit (L, N) parameter-size combination. key_len_bits is L, the bit length of the prime modulus P. mod_len_bits is N, the bit length of the subgroup prime Q.

LNHistorical FIPS 186-4 combination
1024160Legacy
2048224 or 256Supported parameter pairs
3072256Largest listed pair
Current standards status: These combinations come from the superseded FIPS 186-4 DSA specification. FIPS 186-5 no longer approves DSA signature generation; use this method only for compatibility.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
GenKeyFromParamsDerBd
pub fn genKeyFromParamsDerBd(self: Dsa, bd: chilkat.BinData) Error!void
Introduced in version 11.0.0

Generates a new DSA key pair from OpenSSL-style DSA parameters stored as DER bytes in the BinData object passed in bd.

The supplied data contains DSA domain parameters P, Q, and G, not an existing private key. Chilkat validates or imports those parameters and generates a fresh private value X and corresponding public value Y.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
GenKeyFromParamsDerFile
pub fn genKeyFromParamsDerFile(self: Dsa, path: [:0]const u8) Error!void

Generates a new DSA key pair from the OpenSSL-style DER DSA-parameters file specified by path.

The supplied data contains DSA domain parameters P, Q, and G, not an existing private key. Chilkat validates or imports those parameters and generates a fresh private value X and corresponding public value Y.

Returns true when the parameters are loaded and a key pair is generated successfully.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
GenKeyFromParamsPem
pub fn genKeyFromParamsPem(self: Dsa, pem: [:0]const u8) Error!void

Generates a new DSA key pair from OpenSSL-style DSA parameters supplied as PEM text in pem.

The supplied data contains DSA domain parameters P, Q, and G, not an existing private key. Chilkat validates or imports those parameters and generates a fresh private value X and corresponding public value Y.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
GenKeyFromParamsPemFile
pub fn genKeyFromParamsPemFile(self: Dsa, path: [:0]const u8) Error!void

Generates a new DSA key pair from the OpenSSL-style PEM DSA-parameters file specified by path.

The supplied data contains DSA domain parameters P, Q, and G, not an existing private key. Chilkat validates or imports those parameters and generates a fresh private value X and corresponding public value Y.

A typical parameter file is PEM-armored with a BEGIN DSA PARAMETERS header. The newly generated private key can be exported with the applicable To* methods.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
GenKeyFromPQG
pub fn genKeyFromPQG(self: Dsa, p_hex: [:0]const u8, q_hex: [:0]const u8, g_hex: [:0]const u8) Error!void
Introduced in version 9.5.0.90

Generates a new DSA private/public key pair using the preselected domain parameters P, Q, and G supplied in p_hex, q_hex, and g_hex.

Each argument is hexadecimal text in Chilkat's SSH1-format bignum representation. Chilkat generates a fresh private value X and derives Y; the supplied values are domain parameters, not an existing key pair.

Parameter provenance: Only use DSA parameters obtained from a trusted, validated source. Malformed or maliciously chosen domain parameters can undermine signature security.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
GetEncodedHash
pub fn getEncodedHash(self: Dsa, allocator: Allocator, encoding: [:0]const u8) (Error || Allocator.Error)![:0]u8

Returns the current Hash bytes encoded according to encoding. Use hex or base64.

This method does not compute a hash; it only converts the bytes already stored in the Hash property to text.

Returns error.ChilkatFailed on failure; getLastErrorText explains why. The string is allocated with allocator and owned by the caller (defer allocator.free(s)).

top
GetEncodedSignature
pub fn getEncodedSignature(self: Dsa, allocator: Allocator, encoding: [:0]const u8) (Error || Allocator.Error)![:0]u8

Returns the current Signature bytes encoded according to encoding. Use hex or base64.

After a successful SignHash call, the returned bytes are the ASN.1 DER-encoded DSA signature containing the integers r and s.

Returns error.ChilkatFailed on failure; getLastErrorText explains why. The string is allocated with allocator and owned by the caller (defer allocator.free(s)).

top
LoadText
pub fn loadText(self: Dsa, allocator: Allocator, path: [:0]const u8) (Error || Allocator.Error)![:0]u8

Loads the entire file specified by path and returns its contents as text using the legacy ANSI character encoding.

Encoding note: This convenience method is suitable for ASCII-compatible PEM and similar legacy text. It is not a general Unicode file reader; use an API with an explicit character encoding when UTF-8 or other Unicode text must be preserved.

Returns error.ChilkatFailed on failure; getLastErrorText explains why. The string is allocated with allocator and owned by the caller (defer allocator.free(s)).

top
SaveText
pub fn saveText(self: Dsa, str_to_save: [:0]const u8, path: [:0]const u8) Error!void

Writes str_to_save to the file specified by path using the legacy ANSI character encoding. Returns true on success.

Encoding note: This convenience method is appropriate for ASCII-compatible PEM text. It can lose characters that are not representable in the active ANSI encoding, so use an explicitly encoded text-writing API for general Unicode content.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
SetEncodedHash
pub fn setEncodedHash(self: Dsa, encoding: [:0]const u8, encoded_hash: [:0]const u8) Error!void

Decodes encoded_hash using the encoding named by encoding and stores the resulting bytes in the Hash property. Use hex or base64.

The decoded value must be the already-computed message digest that will be signed by SignHash or checked by Verify.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
SetEncodedSignature
pub fn setEncodedSignature(self: Dsa, encoding: [:0]const u8, encoded_sig: [:0]const u8) Error!void

Decodes the signature text in encoded_sig using the encoding named by encoding and stores the resulting bytes in the Signature property. Use hex or base64.

The decoded bytes are expected to contain the ASN.1 DER-encoded DSA signature. Set the corresponding Hash and public key before calling Verify.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
SetEncodedSignatureRS
pub fn setEncodedSignatureRS(self: Dsa, encoding: [:0]const u8, encoded_r: [:0]const u8, encoded_s: [:0]const u8) Error!void

Builds the DSA signature from separately encoded r and s integer values. encoding identifies the encoding used by both encoded_r and encoded_s; use hex or base64.

On success, Signature contains the ASN.1 DER SEQUENCE of the two integers and is ready for use with Verify.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
SetKeyExplicit
pub fn setKeyExplicit(self: Dsa, group_size_in_bytes: i32, p_hex: [:0]const u8, q_hex: [:0]const u8, g_hex: [:0]const u8, x_hex: [:0]const u8) Error!void

Loads a DSA private key from explicitly supplied components. group_size_in_bytes is the size of Q in bytes. p_hex, q_hex, g_hex, and x_hex provide P, Q, G, and the private value X, respectively.

The corresponding public value Y = GX mod P is derived from the private key.

SSH1 bignums: Each component string is hexadecimal text representing an SSH1-format bignum: a two-byte bit-length prefix followed by the unsigned integer bytes.
Sensitive value: xHex contains the private key. Do not expose it in logs or transmit it over an unprotected channel.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
SetPubKeyExplicit
pub fn setPubKeyExplicit(self: Dsa, group_size_in_bytes: i32, p_hex: [:0]const u8, q_hex: [:0]const u8, g_hex: [:0]const u8, y_hex: [:0]const u8) Error!void

Loads a DSA public key from explicitly supplied components. group_size_in_bytes is the size of Q in bytes. p_hex, q_hex, g_hex, and y_hex provide P, Q, G, and the public value Y, respectively.

The resulting object can verify DSA signatures but cannot create them.

SSH1 bignums: Each component string is hexadecimal text representing an SSH1-format bignum: a two-byte bit-length prefix followed by the unsigned integer bytes.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
SignHash
pub fn signHash(self: Dsa) Error!void

Creates a DSA signature over the digest currently stored in Hash. A DSA private key must be loaded, and the digest must be set directly or with SetEncodedHash before this method is called.

On success, Signature contains an ASN.1 DER-encoded sequence of the DSA values r and s. Retrieve it with GetEncodedSignature or read the Signature property.

Security-critical nonce: Each DSA signature requires a secret per-signature value. Reuse or poor generation of that value can reveal the private key. Chilkat performs this generation internally; applications should not attempt to reuse signature state.
Standards status: FIPS 186-5 no longer approves DSA for generating new signatures. Use this method only for required legacy interoperability.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

More Information and Examples
top
ToDerBd
pub fn toDerBd(self: Dsa, bd: chilkat.BinData) Error!void
Introduced in version 11.0.0

Writes the DER-encoded DSA private key to the BinData object passed in bd. Returns true on success.

Sensitive output: The destination contains unencrypted private-key bytes after a successful call. Protect and clear it appropriately.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
ToDerFile
pub fn toDerFile(self: Dsa, path: [:0]const u8) Error!void

Writes the loaded DSA private key to the DER file specified by path. Returns true on success.

Sensitive output: The file contains unencrypted private-key material. Apply restrictive filesystem permissions and avoid writing it to shared or temporary locations.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

More Information and Examples
top
ToEncryptedPem
pub fn toEncryptedPem(self: Dsa, allocator: Allocator, password: [:0]const u8) (Error || Allocator.Error)![:0]u8

Returns the loaded DSA private key as password-encrypted PEM text using password as the password.

Password protection: Use a strong password and protect it separately from the PEM. Encrypted PEM reduces exposure at rest but does not make it safe to log or transmit indiscriminately.

Returns error.ChilkatFailed on failure; getLastErrorText explains why. The string is allocated with allocator and owned by the caller (defer allocator.free(s)).

top
ToPem
pub fn toPem(self: Dsa, allocator: Allocator) (Error || Allocator.Error)![:0]u8

Returns the loaded DSA private key as unencrypted PEM text.

Unencrypted private key: PEM armor is not encryption. Anyone who obtains this text can use the private key, so prefer ToEncryptedPem when password protection is required.

Returns error.ChilkatFailed on failure; getLastErrorText explains why. The string is allocated with allocator and owned by the caller (defer allocator.free(s)).

More Information and Examples
top
ToPublicDerFile
pub fn toPublicDerFile(self: Dsa, path: [:0]const u8) Error!void

Writes the public portion of the loaded DSA key to the DER file specified by path. Returns true on success.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

More Information and Examples
top
ToPublicPem
pub fn toPublicPem(self: Dsa, allocator: Allocator) (Error || Allocator.Error)![:0]u8

Returns the public portion of the loaded DSA key as PEM text. Public-key PEM may be distributed to parties that need to verify signatures; it does not contain the private value X.

Returns error.ChilkatFailed on failure; getLastErrorText explains why. The string is allocated with allocator and owned by the caller (defer allocator.free(s)).

More Information and Examples
top
ToXml
pub fn toXml(self: Dsa, allocator: Allocator, b_public_only: bool) (Error || Allocator.Error)![:0]u8

Returns the loaded DSA key as XML. Set b_public_only to true to export public components only. Set it to false to include the private component when a private key is loaded.

Security: When b_public_only is false, the XML can contain the private value X. Protect it as private-key material.

Returns error.ChilkatFailed on failure; getLastErrorText explains why. The string is allocated with allocator and owned by the caller (defer allocator.free(s)).

More Information and Examples
top
Verify
pub fn verify(self: Dsa) Error!void

Verifies the DSA signature currently stored in Signature against the digest stored in Hash, using the loaded public key. Both values must be set before calling this method.

Returns true only when the signature is valid. A false result can indicate an invalid signature, malformed input, an incompatible key, or another operational error; inspect LastErrorText when the reason matters.

Returns error.ChilkatFailed on failure; getLastErrorText explains why.

top
VerifyKey
pub fn verifyKey(self: Dsa) bool

Checks the mathematical validity and internal consistency of the DSA public or private key currently loaded in the object. Returns true when the key parameters and available key components pass validation.

This does not establish who owns the key, whether the key came from a trusted source, or whether it is suitable for a particular protocol.

More Information and Examples
top