PurePkcs12Bundle class

PKCS#12 bundle decoded in pure Dart (no FFI, no OpenSSL).

It exists because of files encrypted with algorithms that OpenSSL 3.x moved to the legacy provider — chiefly pbeWithSHA1And40BitRC2-CBC, used by several CAs, including Tramita.GOV.BR's. Where the legacy module is not installed (containers, slim servers), this path still works.

final bundle = decodePkcs12Pure(bytes, password: 'secret');
print(bundle.certificatePem);

Supported decryption algorithms:

OID Algoritmo
1.2.840.113549.1.12.1.1 pbeWithSHA1And128BitRC4
1.2.840.113549.1.12.1.2 pbeWithSHA1And40BitRC4
1.2.840.113549.1.12.1.3 pbeWithSHA1And3-KeyTripleDES-CBC
1.2.840.113549.1.12.1.4 pbeWithSHA1And2-KeyTripleDES-CBC
1.2.840.113549.1.12.1.5 pbeWithSHA1And128BitRC2-CBC
1.2.840.113549.1.12.1.6 pbeWithSHA1And40BitRC2-CBC
1.2.840.113549.1.5.13 PBES2 (PBKDF2 + AES-CBC / 3DES-CBC)

Constructors

PurePkcs12Bundle({required Uint8List privateKeyDer, required Uint8List certificateDer, required List<Uint8List> chainDer, String? friendlyName})
const

Properties

certificateDer → Uint8List
End-entity certificate, in DER.
final
certificatePem → String
End-entity certificate in PEM.
no setter
chainDer → List<Uint8List>
Remaining certificates of the file (the chain), in DER.
final
chainPem → List<String>
Chain in PEM, in the order it appeared in the file.
no setter
friendlyName → String?
friendlyName attribute of the key bag, when present.
final
fullPem → String
Key + certificate + chain in a single PEM, in the same shape that openssl pkcs12 -nodes -out file.pem produces.
no setter
hashCode → int
The hash code for this object.
no setterinherited
privateKeyDer → Uint8List
Private key in DER, as a PKCS#8 PrivateKeyInfo.
final
privateKeyPem → String
Private key in PEM (-----BEGIN PRIVATE KEY-----).
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited