DerCodec class

Constructors

DerCodec()

Properties

hashCode → int
The hash code for this object.
no setterinherited
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.
inherited

Operators

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

Static Methods

decodeBls12381PrivateKeyPkcs8(List<int> der) → SecretBytes
decodeBls12381PrivateKeyRaw(List<int> raw, {bool wipeSource = false}) → SecretBytes
decodeBls12381PublicKeySpki(List<int> der) → BuBytes
decodeEcdsaSignatureDer(List<int> der) → (BuBytes, BuBytes)
Decodes an ECDSA-Sig-Value, returning r/s as fixed 32-byte unsigned big-endian scalars (any DER sign-byte padding stripped, any short encoding zero-padded back out) — the shape IECDSASignature expects.
decodeEd25519PrivateKeyPkcs8(List<int> der) → SecretBytes
decodeEd25519PublicKeySpki(List<int> der) → BuBytes
decodeSecp256k1PrivateKeyPkcs8(List<int> der) → Secp256k1Pkcs8Key
decodeSecp256k1PrivateKeySec1(List<int> der) → Secp256k1Sec1Key
decodeSecp256k1PublicKeySpki(List<int> der) → BuBytes
decodeSecp256r1PrivateKeyPkcs8(List<int> der) → Secp256r1Pkcs8Key
decodeSecp256r1PrivateKeySec1(List<int> der) → Secp256r1Sec1Key
decodeSecp256r1PublicKeySpki(List<int> der) → BuBytes
encodeBls12381PrivateKeyPkcs8(List<int> privateKey) → SecretBytes
OPTIONAL, NON-STANDARD: wraps a raw BLS12-381 private key scalar in a PKCS8-shaped PrivateKeyInfo, reusing the real IC algorithm OID pair so it at least round-trips against decodeBls12381PrivateKeyPkcs8 and carries a meaningful algorithm identifier. No implementation of ours or anyone else's (including DFINITY) produces or expects this for private keys — use encodeBls12381PrivateKeyRaw unless you specifically need an ASN.1 container for internal storage/interop.
encodeBls12381PrivateKeyRaw(List<int> privateKey) → BuBytes
Not ASN.1 — a validated pass-through for a raw BLS12-381 private key scalar (32 bytes). This is the format every real BLS12-381 consumer actually uses; there is no DER/PKCS8 standard to conform to here.
encodeBls12381PublicKeySpki(List<int> point) → BuBytes
SubjectPublicKeyInfo for a BLS12-381 G2 public key, matching the exact DER shape DFINITY/Internet Computer uses for root/subnet keys: SEQUENCE { SEQUENCE { OID id-ic-bls12-381, OID curve }, BIT STRING(point) }. point is normally the 96-byte compressed G2 point, but any length is accepted since the wrapper itself doesn't fix one.
encodeEcdsaSignatureDer(List<int> r, List<int> s) → BuBytes
DER-encodes an ECDSA signature's r/s as ECDSA-Sig-Value.
encodeEd25519PrivateKeyPkcs8(List<int> seed) → SecretBytes
PKCS8 PrivateKeyInfo for Ed25519. The "privateKey" OCTET STRING contains the DER of a further OCTET STRING wrapping the raw 32-byte seed (RFC 8410's "CurvePrivateKey").
encodeEd25519PublicKeySpki(List<int> publicKey) → BuBytes
SubjectPublicKeyInfo for Ed25519 — BIT STRING holds the raw 32-byte public key with zero unused bits.
encodeSecp256k1PrivateKeyPkcs8(List<int> privateKey, {List<int>? publicKeyPoint}) → SecretBytes
Wraps a secp256k1 private key in a PKCS8 "PrivateKeyInfo". The curve OID lives in the AlgorithmIdentifier; the nested SEC1 structure omits it (matching common OpenSSL / RFC 5915 output).
encodeSecp256k1PrivateKeySec1(List<int> privateKey, {List<int>? publicKeyPoint, bool includeCurveOid = true}) → SecretBytes
Builds a SEC1 "ECPrivateKey" DER structure.
encodeSecp256k1PublicKeySpki(List<int> point) → BuBytes
Builds a SubjectPublicKeyInfo (SPKI) for a raw secp256k1 EC point (0x04||X||Y uncompressed, or 0x02/0x03||X compressed).
encodeSecp256r1PrivateKeyPkcs8(List<int> privateKey, {List<int>? publicKeyPoint}) → SecretBytes
Wraps a secp256r1 private key in a PKCS8 "PrivateKeyInfo". The curve OID lives in the AlgorithmIdentifier; the nested SEC1 structure omits it (matching common OpenSSL / RFC 5915 output).
encodeSecp256r1PrivateKeySec1(List<int> privateKey, {List<int>? publicKeyPoint, bool includeCurveOid = true}) → SecretBytes
Builds a SEC1 "ECPrivateKey" DER structure.
encodeSecp256r1PublicKeySpki(List<int> point) → BuBytes
Builds a SubjectPublicKeyInfo (SPKI) for a raw secp256r1 EC point (0x04||X||Y uncompressed, or 0x02/0x03||X compressed).
toDer(List<List<int>> values) → BuBytes
DER-encodes a SEQUENCE of INTEGERs from raw unsigned big-endian byte arrays (e.g. [signature.r, signature.s]).