FEATURED · sgcCrypto

Modern cryptography for Delphi, in pure Object Pascal

43 units, no components, no design-time footprint: pass TBytes in, get TBytes back. AES-GCM and ChaCha20-Poly1305 for encryption, SHA-3, BLAKE2 and Argon2 for hashing and key derivation, Ed25519, X25519 and RSA for signatures and key exchange, X.509 parsing and generation, and post-quantum ML-KEM, ML-DSA and SLH-DSA. No external DLL, no OpenSSL binding, and the same source compiles unchanged from Delphi 7 through RAD Studio 13.

  • 43 units, 6 capability families
  • AEAD · Hashing · Signatures · PKI · Post-quantum
  • Zero external dependencies
  • Delphi 7 to 13 · C++ Builder

Forty-Three Units, Six Capability Families

sgcCrypto ships free inside sgcWebSockets Standard, Professional and Enterprise. It is also sold standalone, bundling the sgcWebSockets Core runtime, for developers who own Core alone or hold no sgcWebSockets license at all. Every license carries full source code.

43 Object Pascal units Each one exports plain functions. There is no Tsgc* class and no sgcCrypto_Reg.pas.
6 Capability families Symmetric, hashing and KDF, signatures and key exchange, PKI, post-quantum, OTP and utilities.
0 External dependencies No DLL to ship and no OpenSSL binding to version-match. The primitives live in the unit you add to your uses clause.
6 Target platforms Win32, Win64, Linux64, macOS, iOS and Android from the same source, with no platform guard in sgcVer.inc.
100% Source code included Every primitive steps through in your own debugger rather than disappearing into a binary.
sgcCrypto

A general-purpose cryptography library for Delphi and C++ Builder. Included free from sgcWebSockets Standard up, or sold standalone with the sgcWebSockets Core runtime bundled in, with full source code and royalty-free deployment.

Encrypt, Hash, Sign, Certify, and Outlast the Quantum Question

The families split by the job you are doing rather than by the mathematics behind it, so the unit you reach for is the one named after the thing you are trying to build.

Symmetric · 5 units

AES, ChaCha20 and the AEAD Constructions on Top

sgcCrypto_AES covers CBC, GCM and CTR. sgcCrypto_Modes adds ECB, OFB, CFB, ciphertext stealing, AES-CCM and AES Key Wrap. sgcCrypto_ChaCha implements ChaCha20, XChaCha20, Salsa20 and XSalsa20, and sgcCrypto_Poly1305 pairs Poly1305 with them into the RFC 8439 AEAD ciphers. Decryption compares the authentication tag in constant time and refuses to return plaintext when it fails.

View the symmetric units →
Hashing & KDF · 11 units

SHA-2, SHA-3, BLAKE2 and Every Mainstream KDF

sgcCrypto_SHA2 and sgcCrypto_Keccak cover SHA-1, SHA-2, SHA-3, SHAKE, cSHAKE and KMAC, with BLAKE2b and BLAKE2s alongside them. For turning a password into a key there is PBKDF2, HKDF, scrypt and sgcCrypto_Argon2, which implements all three Argon2 variants, d, i and id. sgcCrypto_SipHash is the fast keyed hash for hash-table keys, and sgcCrypto_HMAC is keyed message authentication over any of the digests.

View the hashing units →
Signatures & key exchange · 10 units

Ed25519, X25519, secp256k1, Brainpool and RSA

Ed25519 and Ed448 sign, X25519 and X448 do the matching Diffie-Hellman, and sgcCrypto_ECCurves adds ECDSA and ECDH over seven curves with RFC 6979 deterministic nonces and BIP-340 Schnorr signing. sgcCrypto_RSA_Keys generates keys at any bit length and exports DER or PEM in both the PKCS#1 and the PKCS#8 form.

See what it can do →
PKI · 5 units

Read, Verify and Generate X.509 Certificates

sgcCrypto_X509 parses a certificate, verifies its issuer, walks a chain and reads a CRL. sgcCrypto_X509_Gen generates a self-signed certificate or a PKCS#10 CSR from scratch, with the full distinguished name, validity window, CA flag, key usage, extended key usage and subject alternative names, signed by an RSA or an EC key.

The certificate surface →
Post-quantum · 6 units

ML-KEM, ML-DSA, SLH-DSA and a Hybrid Combiner

FIPS 203 key encapsulation in all three parameter sets, FIPS 204 signing in ML-DSA-44, 65 and 87, and FIPS 205 in all six SHAKE parameter sets. sgcCrypto_MLKEM_Hybrid combines an X25519 secret with an ML-KEM secret, so the shared key is never weaker than the classical half.

The post-quantum units →

Reference pages for each family:

Call a Function, Get Bytes Back

No object to construct, no context to free, no handle to keep open. Both snippets compile the same in Delphi 7 to 13 and C++ Builder, on every target platform.

uses
  sgcCrypto_Random, sgcCrypto_AES, sgcCrypto_Keccak;
var
  vKey, vIV, vPlain, vAAD, vTag, vCipher, vDigest: TBytes;
begin
  // AES-256-GCM: authenticated encryption in one call
  vKey    := sgcRandomBytes(32);
  vIV     := sgcRandomBytes(12);
  vPlain  := TEncoding.UTF8.GetBytes('confidential payload');
  vCipher := sgcAES_GCM_Encrypt(vKey, vIV, vPlain, vAAD, vTag);

  // SHA-3-256, one call, no context object to manage
  vDigest := sgcSHA3_256(vPlain);

  // Decryption checks the tag in constant time and fails closed
  vPlain  := sgcAES_GCM_Decrypt(vKey, vIV, vCipher, vAAD, vTag);
end;
uses
  sgcCrypto_Random, sgcCrypto_Ed25519, sgcCrypto_MLKEM;
var
  vSeed, vMessage, vSignature: TBytes;
  vPublicKey, vPrivateKey, vCiphertext, vSharedSecret: TBytes;
begin
  // Ed25519 signature from a 32-byte seed
  vSeed      := sgcRandomBytes(32);
  vMessage   := TEncoding.UTF8.GetBytes('sign me');
  vSignature := sgcEd25519_Sign(vSeed, vMessage);

  // ML-KEM-768: post-quantum key encapsulation (FIPS 203)
  sgcMLKEM_GenerateKeyPair(mlkem768, vPublicKey, vPrivateKey);
  sgcMLKEM_Encapsulate(mlkem768, vPublicKey, vCiphertext, vSharedSecret);

  // The peer recovers the same secret from the ciphertext
  sgcMLKEM_Decapsulate(mlkem768, vPrivateKey, vCiphertext, vSharedSecret);
end;

The same shape in Object Pascal and in C++ Builder. The full feature matrix →

Three Things Worth Knowing First

What sgcCrypto is, whether you already own it, and where it runs. All three answers are short, and all three are on this page rather than in the small print.

Six families, forty-three units
family                  units  what it gives you
Symmetric                   5  AES-GCM, AES-CCM, ChaCha20-Poly1305
Hashing & KDF              11  SHA-2, SHA-3, BLAKE2, Argon2, HKDF
Signatures & exchange      10  Ed25519, X25519, ECDSA, RSA-PSS
PKI                         5  X.509 parse, verify, generate, CSR
Post-quantum                6  ML-KEM, ML-DSA, SLH-DSA, hybrid
OTP & misc                  6  HOTP/TOTP, Base32/64url, AE-2 ZIP

No unit registers a component, so nothing appears
  on the palette and nothing is dropped on a form.
  You add the unit to your uses clause and call
  the function.

You may already own sgcCrypto

All 43 units ship inside sgcWebSockets Standard, Professional and Enterprise, and inside All-Access, at no extra cost. If you hold any edition license from Standard up, there is nothing more to buy.

Standalone is for the opposite case

Own only sgcWebSockets Core, or no sgcWebSockets license at all? The standalone package bundles the Core runtime with the crypto units, so you get the library without licensing a full edition.

No platform guard

Nothing in sgcVer.inc restricts sgcCrypto to Windows. The units are ordinary Object Pascal arithmetic, so they compile for Win32, Win64, Linux64, macOS, iOS and Android from one source. sgcCrypto_Random is the one platform-aware unit, selecting a CSPRNG backend per target behind the same sgcRandomBytes call.

Delphi and C++ Builder

sgcCrypto targets Delphi 7 through RAD Studio 13 and C++ Builder. The free trial installer is the sgcWebSockets All-Access trial, so all 43 units can be evaluated today.

FIPS 197 & 202 RFC 8439 RFC 5280 FIPS 203/204/205 Full source

Every unit and function →

sgcCrypto implements the primitives directly rather than binding to a library you also have to ship and version-match, so a key, a digest or a signature is one function call, and full source code means nothing in between is a black box.

Fourteen Libraries, One Toolbox

sgcCrypto is one of fourteen eSeGeCe component libraries for Delphi, C++ Builder and .NET. They share conventions, they ship with full source, and they deploy royalty-free.

sgcCrypto

AEAD encryption, hashing and KDFs, signatures, X.509 and post-quantum cryptography in 43 pure Object Pascal units. Included from sgcWebSockets Standard up, or standalone.

Learn more →

sgcREST

REST server, OpenAPI server and OpenAPI client components for Delphi and C++ Builder. Standalone, with the sgcWebSockets Core runtime bundled in.

Learn more →

sgcHTTP

HTTP/2 client, gRPC client and Google Cloud Pub/Sub, Calendar and FCM clients for Delphi and C++ Builder. Standalone, with the sgcWebSockets Core runtime bundled in.

Learn more →

sgcAuth

OAuth2 client, JWT client and WebAuthn support for Delphi and C++ Builder. Standalone, with the sgcWebSockets Core runtime bundled in.

Learn more →

sgcWebSockets

WebSocket, HTTP/2, MQTT, AMQP, WebRTC, AI and 30+ API integrations for Delphi, C++ Builder, Lazarus and .NET. Its Enterprise edition includes gRPC too.

Learn more →

sgcMQ

MQTT, AMQP 0.9.1 and 1.0, Apache Kafka and STOMP client components for Delphi and C++ Builder. Standalone, with the sgcWebSockets Core runtime bundled in.

Learn more →

sgcSocial

Telegram and WhatsApp Business client components for Delphi and C++ Builder. Standalone, with the sgcWebSockets Core runtime bundled in.

Learn more →

sgcHTML

Server-side HTML and UI components on Bootstrap 5 and htmx for Delphi, C++ Builder and .NET.

Learn more →

sgcQUIC

Raw QUIC transport and an HTTP/3 client and server, with WebTransport. An add-on to sgcWebSockets Enterprise.

Learn more →

sgcAI

AI, LLM and MCP components for Delphi and C++ Builder. Seven LLM providers behind one component, plus MCP, embeddings and speech. Standalone, with the sgcWebSockets Core runtime bundled in.

Learn more →

sgcOpenAPI

OpenAPI 3.x parser, native Pascal SDK generator, OpenAPI server component, and 1,195+ pre-built cloud SDKs.

Learn more →

sgcSign

XAdES, PAdES, CAdES and ASiC for documents, Authenticode, ClickOnce, NuGet and VSIX for code.

Learn more →

sgcBiometrics

Windows Hello, fingerprint sensors and the Windows Biometric Framework for Delphi and C++ Builder.

Learn more →

sgcIndy

Updated Indy TCP/IP components with modern TLS, IPv6 and HTTP/2 for Delphi 7 through 13.

Learn more →

View pricing and licenses Download the free trial

What Developers Say

Trusted by Delphi, C++ Builder, Lazarus and .NET developers around the world.

Your sgcWebSockets library is very useful and easy to setup. Keep up the good work!

Simone Moretti Delphi Developer

sgcWebSockets is amazing and your support is the best!

Christian Meyer Founder & CTO

Thanks so much for your help and support, I love your components.

Mark Steinfeld CTO

Latest from the blog

View all posts →

You are seeing the Cryptography view of eSeGeCe.

Show me another angle →
30-Day Money-Back GuaranteeNot satisfied? Request a full refund within 30 days of purchase. See refund policy

Bytes In, Bytes Out, Native Code

AEAD encryption, hashing, signatures, X.509 and post-quantum cryptography in 43 units, with full source code in the box.