Skip to content

parsePkcs12MacData ​

parsePkcs12MacData ​

Decodes a DER-encoded MacData block. When password is provided, verifies the MAC and reports the outcome in verification.

Returns a typed failure (code: 'malformed') on malformed input, an iteration count below 1, or a PBMAC1 iteration count above 4294967295, 'unsupported_mac_algorithm' for a MAC other than the RFC 7292 SHA-256 MAC or a PBMAC1 variant this implementation does not handle, 'weak_mac_key_length' for a PBMAC1 key length below 20 octets, 'password_not_bmp_string' when an RFC 7292 password contains a UTF-16 surrogate, U+FFFE or U+FFFF, and 'password_not_utf8' when a PBMAC1 password contains an unpaired UTF-16 surrogate. With a password, returns code: 'kdf_iterations_exceeded' when the iteration count exceeds options.maxKdfIterations, or an RFC 7292 MAC count exceeds Number.MAX_SAFE_INTEGER. Without a password no key is derived: options.maxKdfIterations is not applied, an RFC 7292 MAC count above Number.MAX_SAFE_INTEGER is 'malformed', and verification is 'unchecked'. For the throwing form use parsePkcs12MacDataOrThrow.

ts
function parsePkcs12MacData(
	der: Uint8Array,
	authenticatedSafe: Uint8Array,
	password?: string,
	options?: ParsePkcs12MacDataOptions,
): Promise<ParsePkcs12MacDataResult>

Parameters

Released under the MIT License.