openssl_bindings 1.3.0
openssl_bindings: ^1.3.0 copied to clipboard
FFI bindings to OpenSSL cryptographic library for Dart, providing native access to encryption, hashing, and SSL/TLS functionality.
1.3.0 #
A loaded CRL is now readable, not just queryable #
X509Crl could say whether a serial was revoked and nothing else: for how long
that answer was good, who issued the CRL, which entries it carried — all of that
was in the DER and nowhere in the API. It is now read straight from the
structure.
final crl = openSsl.loadCrlBytes(bytes);
print('${crl.issuer} #${crl.crlNumber}'); // issuer DN and CRL number
print(crl.thisUpdate); // when the CA issued it
print(crl.nextUpdate); // when the next one is due
if (crl.isDeltaCrl) print(crl.baseCrlNumber);
for (final entry in crl.revokedEntries) {
print('${entry.serialNumberHex} at ${entry.revocationDate} '
'reason ${entry.reasonCode}');
}
nextUpdate is optional in RFC 5280, and this API keeps that distinction.
null means the CRL states no expiry — not that it has expired — and
isExpired() returns false for such a CRL rather than treating an absent
field as an expired one. isExpired([reference]) takes the instant to validate
at: pass the moment a signature was made to judge the CRL as it stood then, omit
it to check against now.
crl.isExpired(); // stale as of right now?
crl.isExpired(signedAt); // was it still current when this was signed?
Entry reasons follow the same rule: X509RevokedEntry.reasonCode is null when
the entry carries no reason extension, which RFC 5280 reads as unspecified —
distinct from an entry that explicitly says CrlReason.unspecified (0).
Serials are BigInt, with serialNumberHex and serialNumberDecimal for the
forms CAs print, so a 128-bit serial survives intact. version reports 1 or 2,
counting the way people do, not the zero-based encoded value.
CSRs can be loaded and inspected #
A CSR could be built and signed, but never read back: X509Request had exactly
one method, toPem(). It now round-trips.
final csr = openSsl.loadCsrBytes(bytes); // or loadCsrPem / loadCsrDer
print(csr.subject);
print(csr.version);
if (!csr.verifySignature()) {
// The CSR does not prove possession of its own private key — reject it
// before issuing anything.
}
toDer(), publicKey and openSsl.newCsrBuilder() round out the type, the
last one matching newCertificateBuilder() and newCrlBuilder().
Subject Alternative Names, in both directions #
The builder could only write otherName SANs (the ICP-Brasil case), and a
loaded certificate exposed none of the SAN at all. Both sides are filled in:
builder.addSubjectAltNames(
dnsNames: ['example.test', 'www.example.test'],
ipAddresses: ['192.0.2.10', '2001:db8::1'],
);
cert.dnsNames; // ['example.test', 'www.example.test']
cert.ipAddresses; // ['192.0.2.10', '2001:db8::1']
cert.emailAddresses;
cert.subjectAltNameUris;
cert.subjectAltNameOtherNames; // by OID, what icpBrasilInfo parses
cert.certificatePolicyOids;
This is what a TLS certificate needs — clients match the host against the SAN,
not the CN. Values go through OpenSSL's configuration syntax, which separates
entries by comma, so a value containing one is rejected with an ArgumentError
instead of being silently split into two names.
One-shot digests are 2–5x faster on small inputs #
digest, digestHex, sha256 and hmac were paying more to set up the hash
than to compute it. On OpenSSL 3 an EVP_DigestInit_ex re-fetches the
algorithm from its provider and costs around 400 ns; on top of that every call
looked the name up, allocated an EVP_MD_CTX, and freed it again. For a
32-byte input that was ~1.8 us of overhead around ~0.1 us of hashing — slower
than hashing in pure Dart.
Each OpenSSL instance now keeps one context per algorithm, initialised once,
and starts every call by copying it: EVP_MD_CTX_copy_ex costs about 30 ns
against those 400 ns. The algorithm handles and the HMAC context are cached the
same way.
| SHA-256 | before | now | package:crypto |
|---|---|---|---|
| 32 B | 1.86 us | 0.83 us | 1.12 us |
| 1 KiB | 4.58 us | 3.38 us | 14.90 us |
| 1 MiB | 2.97 ms | 2.95 ms | 14.41 ms |
The crossover where the FFI call starts paying for itself moved from 128 bytes to 16. Large inputs are unaffected — there the copy was never the cost.
The API did not change, and neither did any digest it produces; the class holding the cache is internal and is not exported.
Isolates and memory. The cache hangs off the OpenSSL instance and is
never static, so each isolate works on contexts nothing else can reach —
libcrypto only asks that one context is not used by two threads at once. The
contexts are attached to a NativeFinalizer, so an instance that goes out of
scope releases them without anything being disposed by hand, and the number of
cached templates is capped so runtime-built algorithm names cannot grow it
without bound. test/concurrency/multi_isolate_stress_test.dart pins all of
that: several instances interleaved in one isolate, then 8 isolates x 3
instances x 1500 rounds of mixed digest and HMAC work, checking every result
and the process resident set.
script/bench_vs_package_crypto.dart is the comparison against
package:crypto (a dev dependency, used only by that script), checking that
both sides agree on every digest before timing them. It is already ahead at
256 bytes, and from a kilobyte up it runs 2x faster on MD5 through 10x on
SHA-512, with the streaming path at 6x. The README has the full tables under
Benchmarks.
Bindings and internals #
New symbols in ffigen.yaml: X509_CRL_get0_lastUpdate,
X509_CRL_get0_nextUpdate, X509_CRL_get_issuer, X509_CRL_get_version,
X509_CRL_get_REVOKED, X509_CRL_get_ext_d2i,
X509_REVOKED_get0_serialNumber, X509_REVOKED_get0_revocationDate,
X509_REVOKED_get_ext_d2i, ASN1_ENUMERATED_get, PEM_read_bio_X509_REQ,
d2i_X509_REQ and i2d_X509_REQ. Until now only the builders' write-side
counterparts were bound, so reading these fields meant parsing the DER by hand.
The ASN1_TIME to DateTime conversion behind
X509Certificate.notBefore/notAfter and the X509_NAME to DN string
formatting behind subject/issuer moved to shared internal helpers, now used
by the certificate, CRL, CSR and OCSP paths alike. Existing accessors parse and
format exactly as before.
1.2.0 #
Argon2: the pure Dart fallback is 4x faster #
On a libcrypto older than 3.2 — Debian 12 and Ubuntu 22.04/24.04 ship 3.0 —
argon2HashPassword and argon2VerifyPassword run the Dart implementation,
and it was 7x slower than the native one. It has been rewritten for the Dart
VM: one flat Uint64List for the block memory instead of 65 536 small
objects, the compression function on native 64-bit words instead of pairs of
32-bit halves, the permutation unrolled over locals, and BLAKE2b on int
instead of BigInt. The output is unchanged (RFC 9106 vectors, and it still
agrees with OpenSSL's Argon2 byte for byte).
| Argon2id | native (OpenSSL 3.6) | Dart, before | Dart, now (JIT) | Dart, now (AOT) |
|---|---|---|---|---|
| m=64 MiB, t=3, p=1 | 174 ms | 1383 ms | 325 ms | 370 ms |
| m=32 MiB, t=3, p=1 | 87 ms | 683 ms | 163 ms | 182 ms |
| m=19 MiB, t=2, p=1 | 35 ms | 276 ms | 63 ms | 74 ms |
(i5-10500T, 2.3 GHz.) About 2x native is where scalar Dart tops out: the
kernel is 64-bit adds, 32x32-bit multiplies and rotates, none of which
Int32x4 offers, so there is no SIMD path to take. script/bench_argon2.dart
reproduces the table.
One VM quirk worth knowing about, because it is the difference between 60 ms
and 15 s: the JIT sees the two 32-bit operands of lo32(a) * lo32(b), guesses
a Smi multiply, overflows, deoptimises at each of the 32 sites — and past its
budget stops optimising the function at all. The multiply is written as
((lo32(a) | 2^63) * lo32(b)) << 1, which is the same value (the shift drops
the extra bit) with a Mint operand the JIT never speculates on. A test pins
the 19 MiB derivation under 3 s so that cannot silently come back.
Typed digest names #
DigestAlgorithm names the usual digests — sha256, sha512, sha3_256,
blake2b512, md5, … — so a typo is a compile error rather than an
OpenSslException at runtime. It is an extension type over String, so it
goes wherever the API already takes an algorithm name, with nothing to
convert: hmac(DigestAlgorithm.sha256, key, data),
startDigest(DigestAlgorithm.sha512). Any other OpenSSL name still works as
a plain string, or as const DigestAlgorithm('whirlpool').
Hex in and out #
encodeHexanddecodeHexare exported. The encoder was already whatdigestHexandfinishHexused; it is now public for serials, fingerprints and stored hashes, and the decoder is strict — odd length or a non-hex character is aFormatException, not a silently wrong byte.sha256HexandhmacHexjoindigestHex, so no caller has to convert theUint8Listby hand.
EvpDigest.copy() #
Forks an incremental digest: same algorithm, buffer size, byte count and
internal state, then each side evolves on its own. It is EVP_MD_CTX_copy_ex,
and exists for inputs that share a prefix — hash the header once, copy, feed
each nonce — where re-feeding the prefix per attempt is the cost that
dominates. The copy owns its own native resources and is disposed like any
other EvpDigest; disposing either side leaves the other intact.
EVP_MD_CTX_copy_ex is the one new FFI symbol, added to ffigen.yaml and
regenerated.
1.1.0 #
Incremental digests #
Hashing something that does not fit in memory — a multi-hundred-megabyte
attachment, a socket, a request body — previously meant dropping to the raw FFI
layer and driving EVP_MD_CTX by hand. EvpDigest covers that case:
startDigest(alg, {bufferSize})returns anEvpDigest:add/addStreamto feed it,finish/finishHexto read the result,disposeto release. Native memory stays bounded bybufferSize(64 KiB by default) regardless of the input size or the size of each chunk.lengthreports how many bytes were fed, so callers that need the size of what they hashed do not have to measure the input separately.digestStream(alg, stream)anddigestFile(alg, file)for the common case where only the digest matters.digestHex(alg, data)andEvpDigest.finishHex()return lowercase hexadecimal, matching whatpackage:crypto'sDigest.toString()produces.
The context is freed by finish, by dispose (idempotent, safe in a
finally), and by a NativeFinalizer as a last resort, so an input stream that
fails halfway does not leak.
No new FFI symbols were needed — EVP_MD_CTX_new/free,
EVP_DigestInit_ex/Update/Final_ex and EVP_get_digestbyname were already
generated.
JSON Web Keys (RFC 7517) #
An OpenID Connect provider keeps its signing key as a JWK, and there was no way
to get one into an EVP_PKEY short of converting it to PEM by hand — which is
why signing OIDC tokens meant staying on a pure-Dart implementation.
loadPrivateKeyJwk/loadPublicKeyJwkload an RSA JWK directly. The CRT parameters (dp,dq,qi) are optional in a JWK —package:joseomits them when generating a key — so they are derived fromd,pandqwhen absent.loadPublicKeyJwkaccepts a private JWK, ignoring the private half, so one key file yields both keys.EvpPkey.toPublicJwk()exports the public half for ajwks_uriendpoint, with optionalkid,alganduse.loadPrivateKeyDerandEvpPkey.toPublicKeyDer()fill in the DER counterparts of the existing PEM entry points.
RS256 signatures are byte-identical to package:jose's for the same key and
input, so tokens interoperate in both directions. Measured on RSA-2048, signing
a compact JWS is ~4× faster and verifying one ~8× faster than the pure-Dart
path. Only RSA is handled; EC and OKP JWKs throw rather than silently producing
a key that cannot verify anything.
No new FFI symbols here either — d2i_AutoPrivateKey and i2d_PUBKEY were
already generated, and the JWK/DER translation is pure Dart on top of the
existing DER reader.
Multi-isolate coverage and documentation #
test/concurrency/multi_isolate_stress_test.dart runs a workload shaped like a
production backend — long-lived worker isolates serving a mixed load (digests,
streamed file digests, HMAC, AES, RSA sign/verify, certificate building) while
short-lived Isolate.run jobs are spawned and discarded underneath them, all in
one process. It asserts that every isolate's results match the main isolate's,
that an OpenSSL-level failure stays contained in the isolate that raised it,
that no isolate dies with an uncaught error, and that the process resident-set
floor does not climb across rounds. Scale it with ISOLATE_STRESS_WORKERS,
ISOLATE_STRESS_JOBS, ISOLATE_STRESS_ROUNDS and ISOLATE_STRESS_MAX_MB.
Writing it turned up a sharp edge now documented on the OpenSSL class and in
the README: an instance cannot cross an isolate boundary, and a closure passed
to Isolate.run captures its whole enclosing context — so merely writing that
closure in a scope where an OpenSSL variable exists sends the instance along
and the spawn dies with Illegal argument in isolate message: (object is a DynamicLibrary), even when the closure never mentions it. The rule is one
instance per isolate, and spawns hoisted into a top-level function whose scope
holds only sendable data. A test pins it.
1.0.0 #
Legacy PKCS#12 (RC2/RC4) - the case that drove this release #
.p12 files issued by several CAs (Tramita.GOV.BR's among them) use
pbeWithSHA1And40BitRC2-CBC, which OpenSSL 3.0 removed from the default
provider. The symptom was misleading: PKCS12_parse failed (check password?)
with the correct password. There are now three routes, from the simplest to the
most explicit:
ProviderMixin- the OpenSSL 3.x provider API:loadProvider,loadLegacyProvider,unloadProvider,unloadProviders,isProviderAvailable,setProviderSearchPath,providerSearchPathandloadedProviders. Loading goes throughOSSL_PROVIDER_try_load(..., retain_fallbacks=1), so thedefaultprovider stays active. When the module is missing from theMODULESDIRcompiled into libcrypto (common with the Windows installer, which points at a directory that does not exist), the search continues throughOPENSSL_MODULESand the usual platform locations.parsePkcs12(..., legacy: true)loads the provider beforePKCS12_parse;autoLegacy: truedetects the algorithm by OID, loads the provider when needed and, if the module is missing, falls back to the pure Dart decoder.- 100% Dart PKCS#12 decoder (
decodePkcs12Pure/parsePkcs12Pure), with no FFI and no provider: it implements ASN.1/DER, the PKCS#12 KDF, SHA-1, SHA-256, HMAC, PBKDF2, RC2, RC4, DES/3DES and AES-CBC. It supportspbeWithSHA1And{40,128}BitRC{2,4},pbeWithSHA1And{2,3}-KeyTripleDES-CBCand PBES2 (PBKDF2 + AES-CBC/3DES-CBC). Every primitive is checked against the vectors of RFC 2268, RFC 2202, RFC 6070, FIPS 46-3 and FIPS 197.
Diagnostics: pkcs12LegacyAlgorithms(der) and pkcs12NeedsLegacyProvider(der)
identify the algorithm by OID without opening the file, and the parsePkcs12
error message no longer blames the password when the algorithm is the problem.
X.509 chain verification #
VerificationMixin.verifyChain(...)on top ofX509_verify_cert, returning aVerificationResultwith the OpenSSL error code, its message, the depth, the certificate that failed and the chain that was built. Options: anchors, intermediates, CRLs (checkRevocation,checkRevocationChain),verificationTimeto validate old signatures,ignoreValidity,partialChainandmaxDepth.verifyCertificateSignature(cert, issuer)to check the signature alone.
Time-stamping (RFC 3161) #
TimestampMixin, covering the three sides of RFC 3161:- client:
buildTimestampRequest/buildTimestampRequestForDatabuild aTimeStampReqwith a random 64-bit nonce by default, checking that the imprint length matches the digest; - TSA:
createTimestampResponseissues aTimeStampRespfrom a signing certificate that carriesextendedKeyUsage = critical, timeStamping, with the policy, the accepted digests, the declared accuracy, the clock precision and — through the OpenSSL serial callback — a serial number the caller reserves, instead of the constant 1 OpenSSL falls back to; - verification:
verifyTimestampchecks the signature, the message imprint, the nonce and the policy, and builds a chain up to the given trust anchors. It takes either a whole response or a bare archived token; with no nonce at hand (the usual case for an archived token) the nonce check is skipped and everything else still holds.
- client:
parseTimestampResponse/parseTimestampTokenreturnTimestampTokenwithgenTime, serial, policy, imprint, nonce, accuracy, ordering and version, andTimestampResponsewith thePKIStatus, its text and the failure bits.
Argon2 (RFC 9106) #
Argon2Mixin:argon2Derive,argon2DeriveFromString,argon2HashPasswordandargon2VerifyPassword, withArgon2Options(variant, iterations, memory, lanes, length, secret, associated data) and PHC string encoding/parsing ($argon2id$v=19$m=...,t=...,p=...$salt$hash).- Two backends behind the same API: OpenSSL's native Argon2 (
EVP_KDF, from OpenSSL 3.2) when available, and a vendored pure Dart implementation otherwise -hasNativeArgon2reports which one is in play andbackend:forces either. Both are checked against the RFC 9106 vectors for Argon2i, Argon2d and Argon2id, and against each other.
WebAuthn / passkeys #
signandverifynow route keys that reject an external digest - Ed25519, Ed448 and ML-DSA - tosignOneShot/verifyOneShot, instead of failing with OpenSSL's opaqueerror:1C80007A:Provider routines::invalid digest.keyRequiresOneShotSignature(key)exposes the check, andallowOneShotFallback: falserestores the previous behaviour.loadPublicKeyDer(der)loads a SubjectPublicKeyInfo directly, which is the shape a COSE passkey key ends up in;loadPublicKeyBytesauto-detects PEM versus DER.
ICP-Brasil #
IcpBrasilParser: CPF and CNPJ extraction using the official offsets of the DOC-ICP-04 block ([8, 19)for the CPF), preferring the Subject DNserialNumber, with check-digit validation. It also reads the remaining fields of the block - birth date, NIS/PIS and ID card - and carries the named constants for every ICP-BrasilotherNameOID.maskCpf/maskCnpjfor log lines that must not carry a full document number, and anIcpBrasilInfo.toString()that never prints one.- Behaviour change:
IcpBrasilInfo.cpfnow carries the 11-digit CPF rather than the raw positional block, which moved tocpfOtherNameRaw. Code doingcpf.substring(0, 11)used to get a wrong number (birth date + 3 CPF digits). The extraction is positional on purpose: a block can hold more than one 11-digit window with valid check digits, and a birth date can start one - there is a test for exactly that. - Bug fix:
IcpBrasilInfo.birthDatewas read from OID2.16.76.1.3.6, which DOC-ICP-04 defines as the INSS registration (CEI), not a date. The birth date now comes from the first 8 digits of the natural-person block, and the CEI has its ownceifield. - New fields on
IcpBrasilInfo:nis,idCard,cei,voterRegistration,companyName,responsibleNameandisLegalEntity.
Certificate #
X509Certificate.publicKeyandX509Certificate.serialNumberBigInt.
FFI #
ffigen.yamlextended and bindings regenerated withopenssl/provider.h(OSSL_PROVIDER_load,OSSL_PROVIDER_try_load,OSSL_PROVIDER_unload,OSSL_PROVIDER_available,OSSL_PROVIDER_get0_name,OSSL_PROVIDER_{set_default,get0_default}_search_path), chain verification (X509_verify_cert,X509_STORE_CTX_*,X509_VERIFY_PARAM_*,X509_STORE_add_crl, theX509_V_*constants),openssl/kdf.h(EVP_KDF_fetch,EVP_KDF_CTX_new,EVP_KDF_derive, ...),OSSL_PARAM_construct_uint*,d2i_PUBKEY,EVP_PKEY_get_base_id,OBJ_nid2snandopenssl/ts.h(TS_REQ_*,TS_RESP_*,TS_RESP_CTX_*,TS_VERIFY_CTX_*,TS_TST_INFO_*, theTS_STATUS_*/TS_VFY_*constants).
Tests #
test/provider_legacy_test.dart,test/pkcs12_legacy_message_test.dart,test/pkcs12_pure_test.dart,test/chain_verification_test.dart,test/icp_brasil_parser_test.dart,test/argon2_test.dart,test/webauthn_keys_test.dartandtest/timestamp_test.dart(an internal TSA issuing, and the verifier rejecting, a replayed or retargeted token), with a realtest/fixtures/legacy_rc2_40.p12fixture (40-bit RC2).
0.6.0 #
- OCSP (Client APIs):
- Added
OcspClientwith DER request generation and response parsing (buildRequestDer,readResponseStatus). - Added high-level
OcspMixinhelpers:buildOcspRequest(...)andreadOcspResponseStatus(...). - Exported client API in package entrypoint (
lib/openssl.dart).
- Added
- CRL (Loading + Revocation Check):
- Added CRL loading helpers in
X509Mixin:loadCrlPem,loadCrlDer,loadCrlBytes. - Added revocation lookup helpers in
X509Crl:isSerialRevoked,isSerialRevokedDecimal,isSerialRevokedHex,isSerialRevokedBigInt, andisCertificateRevoked.
- Added CRL loading helpers in
- X.509 Extension Reading:
- Added certificate getters for endpoint discovery:
ocspUrls(AIA/OCSP) andcrlDistributionPointUrls(CRL Distribution Points).
- Added certificate getters for endpoint discovery:
- FFI:
- Extended
ffigen.yamland regenerated bindings with CRL/OCSP client-side symbols:d2i_X509_CRL,PEM_read_bio_X509_CRL,X509_CRL_get0_by_serial,d2i_OCSP_RESPONSE,OCSP_response_status,OCSP_response_get1_basic,OCSP_resp_find_status.
- Extended
- PKI Cache Stability:
- Updated CRL/OCSP TTL cache expiration logic in
PkiMixinto use monotonic time (Stopwatch) instead of wall-clock (DateTime.now) to avoid flaky expiration behavior in short TTL tests.
- Updated CRL/OCSP TTL cache expiration logic in
- Tests:
- Added coverage in
test/crl_ocsp_test.dartfor:- OCSP request/response flow without
opensslexecutable. - CRL parsing + serial revocation checks without CLI.
- Reading OCSP/CRL URLs from certificate extensions.
- OCSP request/response flow without
- Added coverage in
0.5.0 #
- ASN.1 / Serial Number APIs (no truncation):
- Added
x509GetSerialBytes(Pointer<X509>). - Added
x509GetSerialHex(Pointer<X509>, {bool prefixed = true}). - Added
x509GetSerialDecimal(Pointer<X509>)via BN decimal conversion. - Added safe ASN.1/BN conversion helpers:
asn1IntegerToHex,asn1IntegerToDecimal,asn1IntegerFromHex.
- Added
- Issuer Matching + Security Rules:
- Added
extractAkiSki,issuerSerialKey, andcertMatchesIssuerhelpers. - Added
prefilterIssuerCandidateswith mandatory fallback to full candidate set when empty/ambiguous. - Reinforced rule: pre-filter never replaces final chain validation and does not decide by CN/text.
- Added
- PKI Performance Caches:
- Added truststore pool/cache by key:
getOrCreateStore(String storeKey, List<Uint8List> rootsDer). - Added parsed certificate cache by DER fingerprint:
getOrCreateParsedX509(Uint8List der). - Added shared helper
fingerprintSha256(Uint8List).
- Added truststore pool/cache by key:
- Revocation Cache (optional):
- Added TTL caches for CRL/OCSP responses:
getCachedCrl/putCachedCrl,getCachedOcsp/putCachedOcsp.
- Added TTL caches for CRL/OCSP responses:
- CI / Coverage:
- Updated GitHub Actions workflow to generate
coverage/lcov.info, upload artifact, and publish to Codecov. - Added Codecov badge and local coverage instructions in README.
- Updated GitHub Actions workflow to generate
- Tests / Organization:
- Added focused tests for ASN.1 serial and error branches.
- Added dedicated PKI cache/matching tests (
test/pki_cache_and_match_test.dart).
- Documentation:
- README reviewed and expanded with missing APIs (PQC keygen, one-shot/ML-DSA signatures, ASN.1 serial helpers, issuer pre-filter/caches, and PEM/DER chain utilities).
0.4.4 #
- CRL (Long Serial Support):
- Added BigInt APIs:
addRevokedSerialBigInt,addRevokedSerialWithReasonBigInt,setCrlNumberBigInt,setDeltaCrlIndicatorBigInt. - Updated
addRevokedSerialHexto support large serials through the BigInt path (removed nativeintlimitation).
- Added BigInt APIs:
- Crypto (Modern/PQC Key Generation):
- Added
generateEd25519,generateEd448. - Added
generateX25519,generateX448. - Added
generateMlDsa44,generateMlDsa65,generateMlDsa87. - Added generic
generateKeyByName(...)helper for provider-based OpenSSL algorithms.
- Added
- Signatures (One-Shot + ML-DSA):
- Added
signOneShotandverifyOneShotwith optionalnulldigest support (required for ML-DSA/EdDSA flows). - Added
MlDsaSignatureOptionswith ML-DSA parameters (context-string,message-encoding,test-entropy,deterministic,mu). - Added high-level helpers:
signMlDsaandverifyMlDsa. - Added convenience presets:
MlDsaSignatureOptions.pure,.deterministic,.mu.
- Added
- FFI:
- Added
EVP_DigestSign,EVP_DigestVerify, andOSSL_PARAM_construct_intto bindings (ffigen.yaml+ regeneratedffi.dart).
- Added
0.4.3 #
- PKI (Mixins):
- Added
PkiMixinandPkiBuilderMixinwith serial generation and issuance helpers. - Added CA rollover/cross‑cert helpers (
createCrossCertificate,createRolloverCrossCertificates).
- Added
- X.509 Builder:
- BigInt serial support, validity setters, DN field helpers, and raw extension support.
- CRL:
- Added CRL Reason per revoked entry, CRL Number, Delta CRL indicator, and Authority Key Identifier support.
- OCSP:
- Added nonce policy handling, responderId by key (flag), and extra responder cert inclusion.
- ASN.1:
- Added negative BigInt two’s‑complement encoding utilities.
- Tests:
- Added/updated tests for PKI helpers, ASN.1, CRL/OCSP, and certificate builder behaviors.
0.4.2 #
- feat(stress): add HTTP signer stress server and test
- add DER export for X509Certificate
- add stress sign server script
- add concurrent stress test for PKCS#7 signing
0.4.1 #
- PKCS#7 padding:
- Added
pkcs7Padandpkcs7Unpadhelpers for high-level padding/unpadding.
- Added
- AES-CBC convenience:
- Added
aesCbcPkcs7EncryptandaesCbcPkcs7Decrypthelpers (AES-128/256).
- Added
- Tests:
- Added coverage for PKCS#7 padding and AES-CBC PKCS#7 helpers.
0.4.0 #
- CRL & OCSP:
- Added
X509CrlandX509CrlBuilderto generate and sign CRLs without invoking the OpenSSL executable. - Added
OcspResponseBuilderandOcspMixinto build DER OCSP responses directly via FFI.
- Added
- Cipher APIs:
- Added AES-128-GCM and AES-128-CBC helpers.
- Added ChaCha20 and ChaCha20-Poly1305 helpers.
- Added Rijndael aliases (mapped to AES-128/256 CBC and GCM).
- TLS constants:
- Added recommended TLS 1.2 cipher suite list and TLS 1.3 ciphersuite list + IDs.
- FFI:
- Extended bindings for CRL/OCSP request/response APIs.
- Tests:
- Added coverage for CRL/OCSP generation and new cipher helpers.
- Docs/cleanup:
- Removed an unnecessary import in the tm bug demonstration script.
0.3.0 #
- Breaking change: Renamed the generated FFI bindings class from
OpenSsltoOpenSslFfifor clarity. - Critical fix: Resolved heap corruption on Linux caused by the
struct tmsize mismatch between Windows and Linux when callingASN1_TIME_to_tm.- Windows
struct tmis 36 bytes; Linux/glibc is larger due totm_gmtoffandtm_zone. - Added platform-specific
tmsizing and safe allocation to prevent buffer overflows.
- Windows
- Memory safety:
- Re-enabled and audited
NativeFinalizerusage across key wrappers. - Fixed missing finalizer attachment in the base
SslObjecthelper.
- Re-enabled and audited
- CI/Testing:
- Added memory-safety regression test for repeated
ASN1_TIME_to_tmparsing. - Linux CI now uses
MALLOC_CHECK_andMALLOC_PERTURB_for earlier detection of heap corruption.
- Added memory-safety regression test for repeated
0.2.0 #
- HTTP/HTTPS Support:
- Introduced
OpenSslHttpClientandOpenSslHttpServerbuilt on OpenSSL BIOs. - Added multi-threaded web server example with isolate support (
example/openssl_web_server.dart).
- Introduced
- Cryptographic Enhancements:
- Ciphers: Added AES (CBC, GCM) and generic cipher support (
CipherMixin). - Hashing & MAC: implemented Digest, HMAC, and PBKDF2.
- Elliptic Curves: Added EC key generation and ECDSA signing/verification.
- PKCS#12: Added support for loading and parsing PKCS#12 bundles.
- Ciphers: Added AES (CBC, GCM) and generic cipher support (
- X.509 & CMS:
- Extensions: Added builder support for Subject Alternative Names (SAN), Key Usage, Extended Key Usage, and Basic Constraints.
- CMS: Added signature verification capabilities (
verifyDetached). - ICP-Brasil: Added helper for ICP-Brasil specific OIDs and extensions.
- TLS/SSL:
- Improved
SecureSocketOpenSslAsyncreliability (fixed hangs, addedrecvExact). - Validated parallel SSL session support.
- Improved
- Internal:
- Refactored native buffer utilities.
- Updated FFI bindings.
0.1.0 #
- Initial release of OpenSSL bindings for Dart.
- Supports loading OpenSSL symbols dynamically (dlopen).
- Core features implemented:
- Crypto: EVP keys management (RSA key generation, loading PEM/DER).
- X.509: Certificate parsing (Subject, Issuer, Serial, Validity, Version), creating self-signed certificates, signing CSRs.
- CMS/PKCS#7: Detached signing (PAdES compatible) using
signDetachedandsignDetachedDigest. - TLS/DTLS:
SecureSocketOpenSSLAsync: Async TLS client/server socket (dart:io compatible interface).SecureSocketOpenSSLSync: Synchronous TLS client/server socket.DtlsClient/DtlsServer: DTLS 1.2+ support over UDP.
- Infrastructure:
- Memory safe architecture using explicit allocators and finalizers.
- Flexible library loading: supports custom paths for
libcryptoandlibsslvia constructor injection or environment variables (OPENSSL_LIBCRYPTO_PATH,OPENSSL_LIBSSL_PATH). - Unit tests covering key generation, certificate building, CMS signing, and SSL/TLS communication.