pfx_reader 1.0.6
pfx_reader: ^1.0.6 copied to clipboard
Flutter plugin to read PKCS#12 (.pfx/.p12) certificate fields and sign data using the embedded private key. Supports Android and iOS.
Versions #
1.0.6 #
- Updates minimum supported SDK version to Flutter 3.44/Dart 3.12.
- Migrates to built-in Kotlin.
1.0.5 #
- Rename package bundle name to avoid java reserved keyword.
1.0.4 #
- Fix issue when building app bundles with this package.
1.0.3 #
- Implement
toJson(). - BREAKING: Migrate
toMap()totoJson()
1.0.2 #
- Fix missmatch android package name.
1.0.1 #
- Provide a proper README.
1.0.0 #
Initial release of pfx_reader.
Features #
- Read X.509 certificate fields from a PKCS#12 (
.pfx/.p12) file on Android and iOS.- Subject DN and individual fields: Common Name (CN), Organization (O), Organizational Unit (OU), Country (C), Email (E)
- Issuer DN
- Validity dates:
notBeforeandnotAfter - Serial number
- Two input methods:
PfxReader.fromBytes(Uint8List, password)— load from raw bytes (e.g. from an asset or file picker)PfxReader.fromFile(String path, password)— load from a file path on disk
- Sign arbitrary data using the private key embedded in the PFX:
PfxReader.signWithBytes(data, pfxBytes, password)PfxReader.signWithFile(data, filePath, password)- Supported algorithms:
SHA256withRSA(default),SHA1withRSA,SHA512withRSA
- Typed
PfxExceptionwithPfxErrorCodeenum instead of rawPlatformException:wrongPassword— incorrect PFX passwordfileNotFound— file path does not existimportError— corrupt or unsupported PFX formatkeyError— private key could not be extractedsignError— signing operation failedunknown— unexpected error
Platform implementation details #
- Android: uses
java.security.KeyStore(PKCS12 provider) andjava.security.Signature - iOS: uses
SecPKCS12Importfor import/signing, and a pure Swift ASN.1 DER parser for certificate field extraction (no macOS-only APIs, fully compatible with iOS simulator and device)