Skip to main content

Crate chilkat

Crate chilkat 

Source
Expand description

The Chilkat class library for Rust.

Chilkat is a commercial, cross-platform library covering HTTP and REST, email (SMTP, POP3, IMAP, MIME, S/MIME), FTP, SFTP, SSH and SCP, zip and other compression, symmetric and public-key cryptography, digital signatures and certificates, XML, JSON, sockets and much more. This crate is the Rust class library: one struct per Chilkat class, generated from the same definitions as Chilkat’s other language bindings, over the Chilkat C API that the chilkat-sys crate declares and links.

§Getting started

[dependencies]
chilkat = "11.6"

The first build downloads the prebuilt Chilkat library for your target (see the chilkat-sys documentation for the CHILKAT_LIB_DIR alternative and the supported targets).

use chilkat::{Http, JsonObject};

fn main() -> chilkat::Result<()> {
    // Any string unlocks the fully functional 30-day trial; a purchased code removes the limit.
    chilkat::unlock_bundle("Anything for 30-day trial")?;

    let http = Http::new();
    http.set_connect_timeout(30);
    let body = http.quick_get_str("https://api.github.com/repos/rust-lang/rust")?;

    let json = JsonObject::new();
    json.load(&body)?;
    println!("{} stars", json.int_of("stargazers_count"));
    Ok(())
}

§How the API maps to Rust

ChilkatRust
class CkHttpchilkat::Http (the Ck prefix is dropped; CkDateTime is DateTime)
method QuickGetStrquick_get_str (snake_case)
property ConnectTimeoutconnect_timeout() / set_connect_timeout(v)
a method returning a success boolResult<()>
a method returning a bool value (HasMember, Contains, …)bool
a method returning a string, or null on failureResult<String>
a method returning an object, or null on failureResult<T> — the returned object is owned and released on drop
an object argument&T; nullable ones (Xml::search_for_attribute’s after) are Option<&T>
const unsigned char *, unsigned long byte buffersone &[u8]
int, unsigned long, __int64, doublei32, u32, i64, f64

Every method takes &self. Chilkat objects are handles with interior state; one thread may use an object at a time, which the types enforce: every class is Send but not Sync, so an object can be moved to another thread but never shared between threads.

Strings are UTF-8 in both directions. A &str argument containing an interior NUL byte cannot be passed to the library: methods that return a Result report it as ErrorKind::InvalidArgument; property setters and methods with no Result panic.

§Errors

Fallible methods return Error, which captures the class, the method and the object’s LastErrorText at the moment of failure — nothing is read on the success path. Display gives a one-line reason; Error::last_error_text gives Chilkat’s full log. The last_error_text(), last_error_xml() and last_error_html() methods of every object remain available for Chilkat’s own conventions.

§Events

The 42 event-capable classes (for example Http, Ftp2, SFtp, Zip, Bz2) deliver AbortCheck, PercentDone and ProgressInfo through the EventHandler trait or the on_abort_check / on_percent_done / on_progress_info closure methods. Events fire on the calling thread while a method runs.

§Not included

Chilkat’s asynchronous method variants (*Async, Task, TaskChain) and the class-specific event callbacks are not part of the Rust API. Use Rust threads for concurrency: objects are Send.

Structs§

Ai
Use one consistent API for multiple AI providers.
Asn
Load, inspect, build, edit, and encode ASN.1 structures in DER or XML form.
AuthAws
Configure AWS request signing for REST calls and temporary pre-signed URLs.
AuthAzureSAS
Create Azure Shared Access Signature tokens for signed Azure Storage requests.
AuthAzureStorage
Authenticate Azure Storage REST requests with account-key Shared Key signing.
AuthGoogle
Obtain Google OAuth 2.0 access tokens using a service account.
BinData
Build, transform, encode, decode, inspect, and save binary data.
Bz2
Bz2 provides BZip2 compression and decompression for files, memory buffers, and BinData. It can create standard .bz2 file images, decompress .bz2 content back to its original bytes, and support abortable long-running operations.
Cache
Store, retrieve, expire, and clean up cached text or binary data on disk.
Cert
Load, inspect, validate, and use X.509 certificates throughout Chilkat.
CertChain
Inspect, verify, export, and work with X.509 certificate chains.
CertStore
Open, search, manage, and use certificate collections from many sources.
Charset
Legacy character-set conversion utilities. Migrate before Chilkat v12.0.0.
CodeSign
Sign, verify, inspect, and remove Authenticode signatures on Windows executables.
Compression
Compress and decompress bytes, text, files, and streams with a flexible API.
Crypt2
Encrypt, decrypt, hash, sign, verify, encode, and authenticate data.
Csr
Create, load, inspect, and verify Certificate Signing Requests.
Csv
Read, edit, sort, and write CSV or delimiter-separated data in memory.
DateTime
CkDateTime represents a date/time value and provides conversion methods for common date/time formats, including .NET DateTime, DateTime ticks, RFC 822, RFC 3339 / ISO 8601-style timestamps, Unix time, DOS date/time, OLE DATE, NTP time, ULID timestamps, and Chilkat DtObj. It also supports date arithmetic, age/expiration checks, serialization, and local/UTC conversion.
Dh
Perform Diffie-Hellman shared-secret key exchange.
DirTree
Iterate through files and subdirectories under a base directory.
Dkim
Sign and verify MIME email with DKIM signatures.
Dns
Configure DNS resolution and query DNS records directly from Chilkat.
Dsa
Generate, import, export, sign, and verify DSA keys and signatures.
DtObj
Represent a date/time as simple editable fields.
Ecc
Generate EC keys, create ECDSA signatures, verify signatures, and compute shared secrets.
EdDSA
Generate Ed25519 keys, sign data, verify signatures, and compute shared secrets.
Email
Create, inspect, modify, secure, load, and save complete email messages.
EmailBundle
Hold, search, sort, remove, save, and reload groups of email messages.
Error
The error type returned by every fallible Chilkat method.
FileAccess
Read, write, compare, copy, split, inspect, and manage files and paths.
Ftp2
Connect, secure, transfer, synchronize, and manage files on FTP servers.
Global
Unlock Chilkat and configure library-wide defaults, diagnostics, and async behavior.
Gzip
Compress, decompress, inspect, and convert GZIP data in files or memory.
Hashtable
Store, look up, remove, enumerate, import, and serialize key/value pairs.
HtmlToText
Convert HTML into readable plain text with control over links, wrapping, and encoding.
HtmlToXml
Convert HTML into well-formed XML for structured parsing and searching.
Http
HTTPS client for REST API calls, GET/POST/PUT/DELETE/PATCH requests, uploads, and downloads.
HttpCurl
curl-style HTTP requests with dependency resolution
HttpRequest
Build structured HTTP requests for use with Chilkat.Http.
HttpResponse
Inspect HTTP status, headers, cookies, redirects, and response bodies.
Imap
Access, search, download, organize, and monitor email on IMAP servers.
JavaKeyStore
Load, inspect, modify, convert, and save Java keystore data.
Js
Execute sandboxed JavaScript inside an application with controlled access to Chilkat features.
JsonArray
Read, modify, search, and emit ordered JSON arrays.
JsonObject
Load, navigate, create, modify, search, sort, and emit JSON objects.
Jwe
Create and decrypt JSON Web Encryption payloads in compact or JSON form.
Jws
Create, serialize, load, inspect, and validate JSON Web Signatures.
Jwt
Create, decode, verify, and time-validate compact JSON Web Tokens.
Log
Build readable structured diagnostic logs with nested context and tagged values.
MailMan
Send, receive, secure, and troubleshoot email with SMTP and POP3.
Mailboxes
Inspect IMAP mailbox names and attributes returned by Chilkat.Imap.
Mcp
A client for the Model Context Protocol (MCP).
MessageSet
Represent and pass sets of IMAP message identifiers.
Mht
Create, save, zip, email, and unpack MHT web archives.
Mime
Build, parse, modify, serialize, secure, and inspect MIME and S/MIME data.
Ntlm
Generate, parse, and verify NTLM authentication messages.
OAuth1
Generate OAuth 1.0 signatures, authorization headers, and signed request URLs.
OAuth2
OAuth2 Authorization Code Flow
Pdf
PDF Signing, Metadata, and Attachments
Pem
Load, inspect, assemble, export, and convert PEM certificate and key material.
Pfx
Load, inspect, build, export, convert, and import PFX / PKCS#12 containers.
Pkcs11
Work directly with PKCS#11 smart cards, USB tokens, and HSMs.
PrivateKey
Load, inspect, export, save, and convert one private key.
Prng
Generate random bytes, encoded values, passwords, and application identifiers.
PublicKey
Load, inspect, convert, export, and use public-key material.
Rest
Build, send, authenticate, stream, and inspect REST API requests with precise control.
Rsa
Encrypt, decrypt, sign, verify, and generate RSA keys.
SCard
Communicate directly with smart card readers and cards through PC/SC.
SFtp
Transfer, list, manage, and synchronize files over SFTP.
SFtpDir
Inspect, sort, and iterate an SFTP directory listing.
SFtpFile
Inspect metadata for a file, directory, symlink, or special item in an SFTP listing.
ScMinidriver
Access smart-card certificates, key containers, PINs, files, and on-card signing.
Scp
Transfer files, text, and binary data over SCP using an existing SSH connection.
Secrets
Manage application secrets through one consistent API.
SecureString
Store, append, compare, hash, verify, and securely access sensitive string values.
ServerSentEvent
Parse server-sent event text into event name, data, ID, and retry fields.
Socket
Build custom TCP, TLS, proxy, SSH-tunneled, client/server, and socket-level protocols.
Spider
Crawl a website domain, manage URL queues, filter links, cache pages, and inspect fetched HTML.
Ssh
Connect to SSH servers, authenticate, run commands, open channels, and manage secure sessions.
SshKey
Import, export, generate, inspect, convert, and use SSH public or private keys.
SshTunnel
Create SSH tunnels for secure local, fixed-destination, dynamic, and multi-hop forwarding.
Stream
Read, write, pipe, monitor, and control byte or text streams.
StringArray
Manage an ordered collection of strings, with StringTable recommended for new code.
StringBuilder
Build, transform, search, encode, decode, hash, and save mutable text.
StringTable
Store, load, search, sort, split, retrieve, and save ordered lists of strings.
Tar
Create, list, verify, filter, and extract TAR archives and compressed TAR formats.
TrustedRoots
Configure the trusted root certificates used by Chilkat certificate validation.
UnixCompress
Compress, uncompress, and unpack legacy UNIX .Z files.
Upload
Upload files with HTTP POST, form fields, headers, progress tracking, and TLS control.
Url
Parse a URL into its host, path, query, credentials, port, fragment, and TLS details.
WebSocket
Connect to WebSocket servers and exchange client-side frames and messages.
Xml
Load, navigate, search, edit, transform, and save in-memory XML trees.
XmlCertVault
Collect certificates, certificate chains, PEM data, and PFX private keys in an XML vault.
XmlDSig
Load, inspect, canonicalize, and verify XML Digital Signatures.
XmlDSigGen
Create XML Digital Signatures with precise control over references, transforms, keys, and placement.
Xmp
Read, modify, add, remove, and save XMP metadata in JPG and TIFF files.
Zip
Create, read, modify, encrypt, and extract ZIP archives.
ZipCrc
Calculate ZIP-compatible CRC32 values for files, bytes, strings, and streamed data.
ZipEntry
Inspect, extract, update, and iterate individual entries inside a ZIP archive.

Enums§

ErrorKind
What went wrong.

Traits§

EventHandler
Receives the events of a Chilkat object while one of its methods runs.

Functions§

unlock_bundle
Unlocks the Chilkat library for the whole process.
version
The Chilkat library version, such as "11.6.1".

Type Aliases§

Result
std::result::Result with Error as the error type.