first commit

This commit is contained in:
2026-05-29 08:20:56 +01:00
commit 949299f58d
6368 changed files with 527176 additions and 0 deletions

View File

@@ -0,0 +1,464 @@
# @suaveplan/crypto-rsa - RSA primitives — RFC 8017 PKCS #1 v2.2, RFC 5208 PKCS #8, RFC 5280 SPKI, RFC 7517/7518 JWK, RFC 7468 PEM. Universal; ships ASN.1/DER, key parse/serialise across PKCS#1/SPKI/PKCS#8/JWK/PEM, modulus-length policy, modular-arithmetic primitives, and the error/observability registry.
## Summary
RSA primitives for Suaveplan — RFC 8017 PKCS #1 v2.2, RFC 5208 / RFC 5958
PKCS #8, RFC 5280 SPKI, RFC 7517 / RFC 7518 JWK, RFC 7468 PEM. Universal package
(zero browser/React dependencies, runs anywhere ES2022 + `BigInt` + `crypto.subtle`
or a `@noble/curves`-compatible engine is available).
This package is shipped in stages. Stage 1 (this release) provides every primitive a
sign/verify/encrypt/decrypt pipeline depends on: ASN.1 / DER reader and writer, key
parsing and serialisation across all five formats, modulus-length policy enforcement,
modular-arithmetic primitives (`modPow`, `i2osp`, `os2ip`, CRT private operation),
PEM textual encoding, and the full error / observability registry. Stages 2-4 will
land the encoding methods (MGF1 + EMSA-PKCS1-v1_5 + EMSA-PSS), the sign / verify /
encrypt / decrypt / key-generation entry points, the engine adapter (`@noble/curves`
+ WebCrypto subtle), and the FIPS / JWK / blinding / fingerprint surface.
<!-- begin:auto-docs -->
## Documentation tree
- [__benchmarks__](./src/__benchmarks__/blinded_vs_unblinded_2048.md) — <!-- begin:auto-docs --> _(no submodules)_ <!-- end:auto-docs -->
- [blinded_vs_unblinded_2048](./src/__benchmarks__/blinded_vs_unblinded_2048.md) — <!-- begin:auto-docs --> _(no submodules)_ <!-- end:auto-docs -->
- [rsa-2048-key](./src/__fixtures__/rsa-2048-key.md) — Real 2048-bit RSA keypair generated once at module-load time and exposed as canonical `RsaPublicKey` / `RsaPrivateKey`…
- [test-keys](./src/__fixtures__/test-keys.md) — Tiny synthetic RSA keypair for unit tests that need an `RsaPrivateKey` / `RsaPublicKey` shape but don't need to run a r…
- [reader](./src/asn1/reader.md) — Strict-DER reader scoped to the RSA key shapes defined in RFC 8017 Appendix A (PKCS#1), RFC 5280 §4.1 + Appendix A (`Su…
- [writer](./src/asn1/writer.md) — Strict-DER encoder mirroring `asn1/reader`. Encodes the same minimal subset of ASN.1 needed to serialise RSA keys in PK…
- [blinding](./src/blinding/blinding.md) — <!-- begin:auto-docs --> _(no submodules)_ <!-- end:auto-docs -->
- [blinding](./src/blinding/blinding.md) — <!-- begin:auto-docs --> _(no submodules)_ <!-- end:auto-docs -->
- [oaep](./src/decrypt/oaep.md) — RSAES-OAEP decryption per RFC 8017 §7.1.2 — counterpart to `encrypt/oaep`. Modern default for RSA public-key encryption.
- [pkcs1v15](./src/decrypt/pkcs1v15.md) — RSAES-PKCS1-v1_5 decryption per RFC 8017 §7.2.2. Counterpart to `encrypt/pkcs1v15`. Provides legacy interop for protoco…
- [emsa-pkcs1-v1_5](./src/encoding/emsa-pkcs1-v1_5.md) — Implements EMSA-PKCS1-v1\_5-ENCODE from RFC 8017 §9.2 — the encoding method underlying RSASSA-PKCS1-v1\_5 signatures. T…
- [emsa-pss-encode](./src/encoding/emsa-pss-encode.md) — Implements the EMSA-PSS encoding operation defined in RFC 8017 §9.1.1. Given a message digest, an encoded-message bit l…
- [emsa-pss-verify](./src/encoding/emsa-pss-verify.md) — Implements the EMSA-PSS verification operation defined in RFC 8017 §9.1.2. Given the message digest, the candidate enco…
- [mgf1](./src/encoding/mgf1.md) — Implements the MGF1 mask-generation function defined in RFC 8017 §B.2.1. MGF1 is the building block used by EMSA-PSS an…
- [default-rng](./src/encrypt/default-rng.md) — Single canonical adapter that lifts the `crypto.getRandomValues` CSPRNG into the `@suaveplan/types` `Rng` interface eve…
- [oaep](./src/encrypt/oaep.md) — RSAES-OAEP encryption per RFC 8017 §7.1.1. The Optimal Asymmetric Encryption Padding (OAEP) scheme is the modern defaul…
- [pkcs1v15](./src/encrypt/pkcs1v15.md) — RSAES-PKCS1-v1_5 encryption per RFC 8017 §7.2.1 — the legacy public-key encryption padding scheme historically used by…
- [noble](./src/engine/noble.md) — Default `RsaCryptoEngine` backed by the pure-JS noble primitives this package ships natively. Provides the `name: "nobl…
- [select](./src/engine/select.md) — Resolve the default `RsaCryptoEngine` for the host runtime. When `globalThis.crypto.subtle` exposes the RSA algorithms…
- [subtle](./src/engine/subtle.md) — `RsaCryptoEngine` adapter over `globalThis.crypto.subtle`. When the host runtime exposes WebCrypto, this engine routes…
- [errors](./src/errors/errors.md) — <!-- begin:auto-docs --> _(no submodules)_ <!-- end:auto-docs -->
- [errors](./src/errors/errors.md) — <!-- begin:auto-docs --> _(no submodules)_ <!-- end:auto-docs -->
- [format](./src/fingerprint/format.md) — Render a fingerprint byte sequence as a human- and machine-readable string. Provides four output formats covering every…
- [spki](./src/fingerprint/spki.md) — Compute a deterministic fingerprint of an RSA public key by hashing its SPKI DER encoding (RFC 5280 §4.1 `SubjectPublic…
- [registry](./src/handle/registry.md) — Process-wide registry for RSA key-handle providers. Every HSM, KMS, OS keychain, or PKCS#11 bridge registers a provider…
- [software](./src/handle/software.md) — Reference `RsaKeyHandleProvider` wrapping in-memory `RsaPrivateKey` values. Implements the same interface as a real HSM…
- [thumbprint-uri](./src/jwk/thumbprint-uri.md) — Compute the JWK Thumbprint URI per RFC 9278 §3 — the canonical `urn:ietf:params:oauth:jwk-thumbprint:<hash-alg>:<base64…
- [thumbprint](./src/jwk/thumbprint.md) — Compute the JWK Thumbprint of an RSA public key per RFC 7638 §3.2. The thumbprint is a deterministic hash over the cano…
- [exponent](./src/keygen/exponent.md) — Public-exponent validation for RSA key generation. The `e`-only constraints (odd, `> 1`, `< 2^256`) live here so they c…
- [generate](./src/keygen/generate.md) — RSA key-pair generation per NIST FIPS 186-5 Appendix A.1 and SP 800-56B Rev. 2 §6.3. Two-prime by default; multi-prime…
- [miller-rabin](./src/keygen/miller-rabin.md) — Probable-prime test per NIST FIPS 186-5 Appendix B.3.1, used by `generateRsaKeyPair` to qualify candidate primes during…
- [multi-prime](./src/keygen/multi-prime.md) — Multi-prime RSA key generation per RFC 8017 §3 and PKCS #1 Appendix A.1.2 `OtherPrimeInfos` extension. Reachable via th…
- [jwk-policy](./src/keys/jwk-policy.md) — Cross-check a JWK's `key_ops`, `use`, and `alg` members against the requested operation per RFC 7517 §4.2 / §4.3 / §4.4…
- [oid](./src/keys/oid.md) — Centralised OID constants for the RSA wire formats handled by this package. Currently exports `OID_RSA_ENCRYPTION` (`1.…
- [parse-jwk](./src/keys/parse-jwk.md) — Parses RSA JWKs per RFC 7517 §6.3.1 (public) and §6.3.2 (private). Accepts the JWK as a plain JS object literal, as a J…
- [parse-pkcs1-private](./src/keys/parse-pkcs1-private.md) — Parses a DER-encoded `RSAPrivateKey` per RFC 8017 Appendix A.1.2 into the canonical `RsaPrivateKey` shape with mandator…
- [parse-pkcs1-public](./src/keys/parse-pkcs1-public.md) — Parses a DER-encoded `RSAPublicKey ::= SEQUENCE { modulus INTEGER, publicExponent INTEGER }` per RFC 8017 Appendix A.1.…
- [parse-pkcs8](./src/keys/parse-pkcs8.md) — Parses a PKCS#8 `PrivateKeyInfo` per RFC 5208 §5 — also accepts the RFC 5958 `OneAsymmetricKey` shape, which adds optio…
- [parse-spki](./src/keys/parse-spki.md) — Parses an X.509 `SubjectPublicKeyInfo` per RFC 5280 §4.1 + Appendix A and unwraps the inner PKCS#1 `RSAPublicKey`. SPKI…
- [parse](./src/keys/parse.md) — Public dispatcher entry-point unifying the four key-format parsers (PKCS#1, SPKI, PKCS#8, JWK) under one ergonomic call…
- [serialize-jwk](./src/keys/serialize-jwk.md) — Inverse of `parseRsaPublicKeyJwk` and `parseRsaPrivateKeyJwk`. Emits an `RsaJwk` with every numeric field encoded as ba…
- [serialize-pkcs1-private](./src/keys/serialize-pkcs1-private.md) — Inverse of `parseRsaPrivateKeyPkcs1`. Emits a DER `RSAPrivateKey` SEQUENCE per RFC 8017 Appendix A.1.2 from a canonical…
- [serialize-pkcs1-public](./src/keys/serialize-pkcs1-public.md) — Inverse of `parseRsaPublicKeyPkcs1`. Emits a DER `RSAPublicKey` SEQUENCE per RFC 8017 Appendix A.1.1 from a canonical `…
- [serialize-pkcs8](./src/keys/serialize-pkcs8.md) — Inverse of `parseRsaPrivateKeyPkcs8`. Wraps a serialised PKCS#1 `RSAPrivateKey` in a DER `PrivateKeyInfo` per RFC 5208…
- [serialize-spki](./src/keys/serialize-spki.md) — Inverse of `parseRsaPublicKeySpki`. Wraps a serialised PKCS#1 `RSAPublicKey` in a DER `SubjectPublicKeyInfo` per RFC 52…
- [serialize](./src/keys/serialize.md) — Public dispatcher entry-point inverse of `parse`. Selects the per-format serialiser via the same `format` discriminator…
- [crt](./src/math/crt.md) — RSA private-key operation via the Chinese Remainder Theorem (RFC 8017 §5.1.2, second-form algorithm). Computes `m = c^d…
- [i2osp](./src/math/i2osp.md) — Integer-to-Octet-String Primitive (RFC 8017 §4.1). Encodes a non-negative integer as a fixed-length big-endian byte str…
- [modpow](./src/math/modpow.md) — Single-source-of-truth modular exponentiation for the entire `@suaveplan/crypto-rsa` package. Wraps `@noble/curves/abst…
- [os2ip](./src/math/os2ip.md) — Octet-String-to-Integer Primitive (RFC 8017 §4.2). Decodes a big-endian byte string into a non-negative `bigint`. Used…
- [metrics](./src/observability/metrics.md) — OpenTelemetry meter + instrument registry for `@suaveplan/crypto-rsa`. defines the full instrument set the prop…
- [timing](./src/observability/timing.md) — Centralised high-resolution clock source used by every metric histogram in `@suaveplan/crypto-rsa`. Resolves to `perfor…
- [labels](./src/pem/labels.md) — Centralised PEM textual labels per RFC 7468 §5/§10/§11 used by the public and private PEM parsers and serialisers in th…
- [parse-private](./src/pem/parse-private.md) — Parse an RSA private key from RFC 7468 PEM textual encoding. Accepts the two canonical private-key armor labels — `"PRI…
- [parse-public](./src/pem/parse-public.md) — Parse an RSA public key from RFC 7468 PEM textual encoding. Accepts both canonical armor labels — `"PUBLIC KEY"` (SPKI…
- [pem-codec](./src/pem/pem-codec.md) — Underlying RFC 7468 textual-encoding codec used by the four PEM parse/serialise entry points in this module. Splits the…
- [serialize-private](./src/pem/serialize-private.md) — Inverse of `parseRsaPrivateKeyPem`. Emits PEM textual encoding for an RSA private key in either PKCS#8 (`"PRIVATE KEY"`…
- [serialize-public](./src/pem/serialize-public.md) — Inverse of `parseRsaPublicKeyPem`. Emits PEM textual encoding for an RSA public key in either SPKI (`"PUBLIC KEY"`, the…
- [policy](./src/policy/modulus.md) — <!-- begin:auto-docs --> _(no submodules)_ <!-- end:auto-docs -->
- [modulus](./src/policy/modulus.md) — <!-- begin:auto-docs --> _(no submodules)_ <!-- end:auto-docs -->
- [profile](./src/profile/profile.md) — <!-- begin:auto-docs --> _(no submodules)_ <!-- end:auto-docs -->
- [profile](./src/profile/profile.md) — <!-- begin:auto-docs --> _(no submodules)_ <!-- end:auto-docs -->
- [schemas](./src/schemas/schemas.md) — <!-- begin:auto-docs --> _(no submodules)_ <!-- end:auto-docs -->
- [schemas](./src/schemas/schemas.md) — <!-- begin:auto-docs --> _(no submodules)_ <!-- end:auto-docs -->
- [pkcs1v15](./src/sign/pkcs1v15.md) — RSASSA-PKCS1-v1\_5 signature generation per RFC 8017 §8.2.1. Hashes the message with the configured algorithm, applies…
- [pss](./src/sign/pss.md) — RSASSA-PSS signature generation per RFC 8017 §8.1.1. Hashes the message, draws a random salt of the configured length,…
- [pkcs1v15](./src/verify/pkcs1v15.md) — RSASSA-PKCS1-v1\_5 signature verification per RFC 8017 §8.2.2. Recovers the encoded message from `signature` via `s^e m…
- [pss](./src/verify/pss.md) — RSASSA-PSS signature verification per RFC 8017 §8.1.2. Recovers the encoded message via `s^e mod n`, then runs the EMSA…
<!-- end:auto-docs --> + [blinded_vs_unblinded_2048](./src/__benchmarks__/blinded_vs_unblinded_2048.md) — <!-- begin:auto-docs --> _(no submodules)_+ [rsa-2048-key](./src/__fixtures__/rsa-2048-key.md) — Real 2048-bit RSA keypair generated once at module-load time and exposed as canonical `RsaPublicKey` / `RsaPrivateKey`…
+ [test-keys](./src/__fixtures__/test-keys.md) — Tiny synthetic RSA keypair for unit tests that need an `RsaPrivateKey` / `RsaPublicKey` shape but don't need to run a r…
+ [reader](./src/asn1/reader.md) — Strict-DER reader scoped to the RSA key shapes defined in RFC 8017 Appendix A (PKCS#1), RFC 5280 §4.1 + Appendix A (`Su…
+ [writer](./src/asn1/writer.md) — Strict-DER encoder mirroring `asn1/reader`. Encodes the same minimal subset of ASN.1 needed to serialise RSA keys in PK…
+ [blinding](./src/blinding/blinding.md) — <!-- begin:auto-docs --> _(no submodules)_+ [blinding](./src/blinding/blinding.md) — <!-- begin:auto-docs --> _(no submodules)_+ [oaep](./src/decrypt/oaep.md) — RSAES-OAEP decryption per RFC 8017 §7.1.2 — counterpart to `encrypt/oaep`. Modern default for RSA public-key encryption.
+ [pkcs1v15](./src/decrypt/pkcs1v15.md) — RSAES-PKCS1-v1_5 decryption per RFC 8017 §7.2.2. Counterpart to `encrypt/pkcs1v15`. Provides legacy interop for protoco…
+ [emsa-pkcs1-v1_5](./src/encoding/emsa-pkcs1-v1_5.md) — Implements EMSA-PKCS1-v1\_5-ENCODE from RFC 8017 §9.2 — the encoding method underlying RSASSA-PKCS1-v1\_5 signatures. T…
+ [emsa-pss-encode](./src/encoding/emsa-pss-encode.md) — Implements the EMSA-PSS encoding operation defined in RFC 8017 §9.1.1. Given a message digest, an encoded-message bit l…
+ [emsa-pss-verify](./src/encoding/emsa-pss-verify.md) — Implements the EMSA-PSS verification operation defined in RFC 8017 §9.1.2. Given the message digest, the candidate enco…
+ [mgf1](./src/encoding/mgf1.md) — Implements the MGF1 mask-generation function defined in RFC 8017 §B.2.1. MGF1 is the building block used by EMSA-PSS an…
+ [default-rng](./src/encrypt/default-rng.md) — Single canonical adapter that lifts the `crypto.getRandomValues` CSPRNG into the `@suaveplan/types` `Rng` interface eve…
+ [oaep](./src/encrypt/oaep.md) — RSAES-OAEP encryption per RFC 8017 §7.1.1. The Optimal Asymmetric Encryption Padding (OAEP) scheme is the modern defaul…
+ [pkcs1v15](./src/encrypt/pkcs1v15.md) — RSAES-PKCS1-v1_5 encryption per RFC 8017 §7.2.1 — the legacy public-key encryption padding scheme historically used by…
+ [noble](./src/engine/noble.md) — Default `RsaCryptoEngine` backed by the pure-JS noble primitives this package ships natively. Provides the `name: "nobl…
+ [select](./src/engine/select.md) — Resolve the default `RsaCryptoEngine` for the host runtime. When `globalThis.crypto.subtle` exposes the RSA algorithms…
+ [subtle](./src/engine/subtle.md) — `RsaCryptoEngine` adapter over `globalThis.crypto.subtle`. When the host runtime exposes WebCrypto, this engine routes…
+ [errors](./src/errors/errors.md) — <!-- begin:auto-docs --> _(no submodules)_+ [errors](./src/errors/errors.md) — <!-- begin:auto-docs --> _(no submodules)_+ [format](./src/fingerprint/format.md) — Render a fingerprint byte sequence as a human- and machine-readable string. Provides four output formats covering every…
+ [spki](./src/fingerprint/spki.md) — Compute a deterministic fingerprint of an RSA public key by hashing its SPKI DER encoding (RFC 5280 §4.1 `SubjectPublic…
+ [registry](./src/handle/registry.md) — Process-wide registry for RSA key-handle providers. Every HSM, KMS, OS keychain, or PKCS#11 bridge registers a provider…
+ [software](./src/handle/software.md) — Reference `RsaKeyHandleProvider` wrapping in-memory `RsaPrivateKey` values. Implements the same interface as a real HSM…
+ [thumbprint-uri](./src/jwk/thumbprint-uri.md) — Compute the JWK Thumbprint URI per RFC 9278 §3 — the canonical `urn:ietf:params:oauth:jwk-thumbprint:<hash-alg>:<base64…
+ [thumbprint](./src/jwk/thumbprint.md) — Compute the JWK Thumbprint of an RSA public key per RFC 7638 §3.2. The thumbprint is a deterministic hash over the cano…
+ [exponent](./src/keygen/exponent.md) — Public-exponent validation for RSA key generation. The `e`-only constraints (odd, `> 1`, `< 2^256`) live here so they c…
+ [generate](./src/keygen/generate.md) — RSA key-pair generation per NIST FIPS 186-5 Appendix A.1 and SP 800-56B Rev. 2 §6.3. Two-prime by default; multi-prime…
+ [miller-rabin](./src/keygen/miller-rabin.md) — Probable-prime test per NIST FIPS 186-5 Appendix B.3.1, used by `generateRsaKeyPair` to qualify candidate primes during…
+ [multi-prime](./src/keygen/multi-prime.md) — Multi-prime RSA key generation per RFC 8017 §3 and PKCS #1 Appendix A.1.2 `OtherPrimeInfos` extension. Reachable via th…
+ [jwk-policy](./src/keys/jwk-policy.md) — Cross-check a JWK's `key_ops`, `use`, and `alg` members against the requested operation per RFC 7517 §4.2 / §4.3 / §4.4…
+ [oid](./src/keys/oid.md) — Centralised OID constants for the RSA wire formats handled by this package. Currently exports `OID_RSA_ENCRYPTION` (`1.…
+ [parse-jwk](./src/keys/parse-jwk.md) — Parses RSA JWKs per RFC 7517 §6.3.1 (public) and §6.3.2 (private). Accepts the JWK as a plain JS object literal, as a J…
+ [parse-pkcs1-private](./src/keys/parse-pkcs1-private.md) — Parses a DER-encoded `RSAPrivateKey` per RFC 8017 Appendix A.1.2 into the canonical `RsaPrivateKey` shape with mandator…
+ [parse-pkcs1-public](./src/keys/parse-pkcs1-public.md) — Parses a DER-encoded `RSAPublicKey ::= SEQUENCE { modulus INTEGER, publicExponent INTEGER }` per RFC 8017 Appendix A.1.…
+ [parse-pkcs8](./src/keys/parse-pkcs8.md) — Parses a PKCS#8 `PrivateKeyInfo` per RFC 5208 §5 — also accepts the RFC 5958 `OneAsymmetricKey` shape, which adds optio…
+ [parse-spki](./src/keys/parse-spki.md) — Parses an X.509 `SubjectPublicKeyInfo` per RFC 5280 §4.1 + Appendix A and unwraps the inner PKCS#1 `RSAPublicKey`. SPKI…
+ [parse](./src/keys/parse.md) — Public dispatcher entry-point unifying the four key-format parsers (PKCS#1, SPKI, PKCS#8, JWK) under one ergonomic call…
+ [serialize-jwk](./src/keys/serialize-jwk.md) — Inverse of `parseRsaPublicKeyJwk` and `parseRsaPrivateKeyJwk`. Emits an `RsaJwk` with every numeric field encoded as ba…
+ [serialize-pkcs1-private](./src/keys/serialize-pkcs1-private.md) — Inverse of `parseRsaPrivateKeyPkcs1`. Emits a DER `RSAPrivateKey` SEQUENCE per RFC 8017 Appendix A.1.2 from a canonical…
+ [serialize-pkcs1-public](./src/keys/serialize-pkcs1-public.md) — Inverse of `parseRsaPublicKeyPkcs1`. Emits a DER `RSAPublicKey` SEQUENCE per RFC 8017 Appendix A.1.1 from a canonical `…
+ [serialize-pkcs8](./src/keys/serialize-pkcs8.md) — Inverse of `parseRsaPrivateKeyPkcs8`. Wraps a serialised PKCS#1 `RSAPrivateKey` in a DER `PrivateKeyInfo` per RFC 5208…
+ [serialize-spki](./src/keys/serialize-spki.md) — Inverse of `parseRsaPublicKeySpki`. Wraps a serialised PKCS#1 `RSAPublicKey` in a DER `SubjectPublicKeyInfo` per RFC 52…
+ [serialize](./src/keys/serialize.md) — Public dispatcher entry-point inverse of `parse`. Selects the per-format serialiser via the same `format` discriminator…
+ [crt](./src/math/crt.md) — RSA private-key operation via the Chinese Remainder Theorem (RFC 8017 §5.1.2, second-form algorithm). Computes `m = c^d…
+ [i2osp](./src/math/i2osp.md) — Integer-to-Octet-String Primitive (RFC 8017 §4.1). Encodes a non-negative integer as a fixed-length big-endian byte str…
+ [modpow](./src/math/modpow.md) — Single-source-of-truth modular exponentiation for the entire `@suaveplan/crypto-rsa` package. Wraps `@noble/curves/abst…
+ [os2ip](./src/math/os2ip.md) — Octet-String-to-Integer Primitive (RFC 8017 §4.2). Decodes a big-endian byte string into a non-negative `bigint`. Used…
+ [metrics](./src/observability/metrics.md) — OpenTelemetry meter + instrument registry for `@suaveplan/crypto-rsa`. defines the full instrument set the prop…
+ [timing](./src/observability/timing.md) — Centralised high-resolution clock source used by every metric histogram in `@suaveplan/crypto-rsa`. Resolves to `perfor…
+ [labels](./src/pem/labels.md) — Centralised PEM textual labels per RFC 7468 §5/§10/§11 used by the public and private PEM parsers and serialisers in th…
+ [parse-private](./src/pem/parse-private.md) — Parse an RSA private key from RFC 7468 PEM textual encoding. Accepts the two canonical private-key armor labels — `"PRI…
+ [parse-public](./src/pem/parse-public.md) — Parse an RSA public key from RFC 7468 PEM textual encoding. Accepts both canonical armor labels — `"PUBLIC KEY"` (SPKI…
+ [pem-codec](./src/pem/pem-codec.md) — Underlying RFC 7468 textual-encoding codec used by the four PEM parse/serialise entry points in this module. Splits the…
+ [serialize-private](./src/pem/serialize-private.md) — Inverse of `parseRsaPrivateKeyPem`. Emits PEM textual encoding for an RSA private key in either PKCS#8 (`"PRIVATE KEY"`…
+ [serialize-public](./src/pem/serialize-public.md) — Inverse of `parseRsaPublicKeyPem`. Emits PEM textual encoding for an RSA public key in either SPKI (`"PUBLIC KEY"`, the…
+ [policy](./src/policy/modulus.md) — <!-- begin:auto-docs --> _(no submodules)_+ [modulus](./src/policy/modulus.md) — <!-- begin:auto-docs --> _(no submodules)_+ [profile](./src/profile/profile.md) — <!-- begin:auto-docs --> _(no submodules)_+ [profile](./src/profile/profile.md) — <!-- begin:auto-docs --> _(no submodules)_+ [schemas](./src/schemas/schemas.md) — <!-- begin:auto-docs --> _(no submodules)_+ [schemas](./src/schemas/schemas.md) — <!-- begin:auto-docs --> _(no submodules)_+ [pkcs1v15](./src/sign/pkcs1v15.md) — RSASSA-PKCS1-v1\_5 signature generation per RFC 8017 §8.2.1. Hashes the message with the configured algorithm, applies…
+ [pss](./src/sign/pss.md) — RSASSA-PSS signature generation per RFC 8017 §8.1.1. Hashes the message, draws a random salt of the configured length,…
+ [pkcs1v15](./src/verify/pkcs1v15.md) — RSASSA-PKCS1-v1\_5 signature verification per RFC 8017 §8.2.2. Recovers the encoded message from `signature` via `s^e m…
+ [pss](./src/verify/pss.md) — RSASSA-PSS signature verification per RFC 8017 §8.1.2. Recovers the encoded message via `s^e mod n`, then runs the EMSA…
+ [blinded_vs_unblinded_2048](./src/__benchmarks__/blinded_vs_unblinded_2048.md) — <!-- begin:auto-docs --> _(no submodules)_+ [rsa-2048-key](./src/__fixtures__/rsa-2048-key.md) — Real 2048-bit RSA keypair generated once at module-load time and exposed as canonical `RsaPublicKey` / `RsaPrivateKey`…
+ [test-keys](./src/__fixtures__/test-keys.md) — Tiny synthetic RSA keypair for unit tests that need an `RsaPrivateKey` / `RsaPublicKey` shape but don't need to run a r…
+ [reader](./src/asn1/reader.md) — Strict-DER reader scoped to the RSA key shapes defined in RFC 8017 Appendix A (PKCS#1), RFC 5280 §4.1 + Appendix A (`Su…
+ [writer](./src/asn1/writer.md) — Strict-DER encoder mirroring `asn1/reader`. Encodes the same minimal subset of ASN.1 needed to serialise RSA keys in PK…
+ [blinding](./src/blinding/blinding.md) — <!-- begin:auto-docs --> _(no submodules)_+ [blinding](./src/blinding/blinding.md) — <!-- begin:auto-docs --> _(no submodules)_+ [oaep](./src/decrypt/oaep.md) — RSAES-OAEP decryption per RFC 8017 §7.1.2 — counterpart to `encrypt/oaep`. Modern default for RSA public-key encryption.
+ [pkcs1v15](./src/decrypt/pkcs1v15.md) — RSAES-PKCS1-v1_5 decryption per RFC 8017 §7.2.2. Counterpart to `encrypt/pkcs1v15`. Provides legacy interop for protoco…
+ [emsa-pkcs1-v1_5](./src/encoding/emsa-pkcs1-v1_5.md) — Implements EMSA-PKCS1-v1\_5-ENCODE from RFC 8017 §9.2 — the encoding method underlying RSASSA-PKCS1-v1\_5 signatures. T…
+ [emsa-pss-encode](./src/encoding/emsa-pss-encode.md) — Implements the EMSA-PSS encoding operation defined in RFC 8017 §9.1.1. Given a message digest, an encoded-message bit l…
+ [emsa-pss-verify](./src/encoding/emsa-pss-verify.md) — Implements the EMSA-PSS verification operation defined in RFC 8017 §9.1.2. Given the message digest, the candidate enco…
+ [mgf1](./src/encoding/mgf1.md) — Implements the MGF1 mask-generation function defined in RFC 8017 §B.2.1. MGF1 is the building block used by EMSA-PSS an…
+ [default-rng](./src/encrypt/default-rng.md) — Single canonical adapter that lifts the `crypto.getRandomValues` CSPRNG into the `@suaveplan/types` `Rng` interface eve…
+ [oaep](./src/encrypt/oaep.md) — RSAES-OAEP encryption per RFC 8017 §7.1.1. The Optimal Asymmetric Encryption Padding (OAEP) scheme is the modern defaul…
+ [pkcs1v15](./src/encrypt/pkcs1v15.md) — RSAES-PKCS1-v1_5 encryption per RFC 8017 §7.2.1 — the legacy public-key encryption padding scheme historically used by…
+ [noble](./src/engine/noble.md) — Default `RsaCryptoEngine` backed by the pure-JS noble primitives this package ships natively. Provides the `name: "nobl…
+ [select](./src/engine/select.md) — Resolve the default `RsaCryptoEngine` for the host runtime. When `globalThis.crypto.subtle` exposes the RSA algorithms…
+ [subtle](./src/engine/subtle.md) — `RsaCryptoEngine` adapter over `globalThis.crypto.subtle`. When the host runtime exposes WebCrypto, this engine routes…
+ [errors](./src/errors/errors.md) — <!-- begin:auto-docs --> _(no submodules)_+ [errors](./src/errors/errors.md) — <!-- begin:auto-docs --> _(no submodules)_+ [format](./src/fingerprint/format.md) — Render a fingerprint byte sequence as a human- and machine-readable string. Provides four output formats covering every…
+ [spki](./src/fingerprint/spki.md) — Compute a deterministic fingerprint of an RSA public key by hashing its SPKI DER encoding (RFC 5280 §4.1 `SubjectPublic…
+ [registry](./src/handle/registry.md) — Process-wide registry for RSA key-handle providers. Every HSM, KMS, OS keychain, or PKCS#11 bridge registers a provider…
+ [software](./src/handle/software.md) — Reference `RsaKeyHandleProvider` wrapping in-memory `RsaPrivateKey` values. Implements the same interface as a real HSM…
+ [thumbprint-uri](./src/jwk/thumbprint-uri.md) — Compute the JWK Thumbprint URI per RFC 9278 §3 — the canonical `urn:ietf:params:oauth:jwk-thumbprint:<hash-alg>:<base64…
+ [thumbprint](./src/jwk/thumbprint.md) — Compute the JWK Thumbprint of an RSA public key per RFC 7638 §3.2. The thumbprint is a deterministic hash over the cano…
+ [exponent](./src/keygen/exponent.md) — Public-exponent validation for RSA key generation. The `e`-only constraints (odd, `> 1`, `< 2^256`) live here so they c…
+ [generate](./src/keygen/generate.md) — RSA key-pair generation per NIST FIPS 186-5 Appendix A.1 and SP 800-56B Rev. 2 §6.3. Two-prime by default; multi-prime…
+ [miller-rabin](./src/keygen/miller-rabin.md) — Probable-prime test per NIST FIPS 186-5 Appendix B.3.1, used by `generateRsaKeyPair` to qualify candidate primes during…
+ [multi-prime](./src/keygen/multi-prime.md) — Multi-prime RSA key generation per RFC 8017 §3 and PKCS #1 Appendix A.1.2 `OtherPrimeInfos` extension. Reachable via th…
+ [jwk-policy](./src/keys/jwk-policy.md) — Cross-check a JWK's `key_ops`, `use`, and `alg` members against the requested operation per RFC 7517 §4.2 / §4.3 / §4.4…
+ [oid](./src/keys/oid.md) — Centralised OID constants for the RSA wire formats handled by this package. Currently exports `OID_RSA_ENCRYPTION` (`1.…
+ [parse-jwk](./src/keys/parse-jwk.md) — Parses RSA JWKs per RFC 7517 §6.3.1 (public) and §6.3.2 (private). Accepts the JWK as a plain JS object literal, as a J…
+ [parse-pkcs1-private](./src/keys/parse-pkcs1-private.md) — Parses a DER-encoded `RSAPrivateKey` per RFC 8017 Appendix A.1.2 into the canonical `RsaPrivateKey` shape with mandator…
+ [parse-pkcs1-public](./src/keys/parse-pkcs1-public.md) — Parses a DER-encoded `RSAPublicKey ::= SEQUENCE { modulus INTEGER, publicExponent INTEGER }` per RFC 8017 Appendix A.1.…
+ [parse-pkcs8](./src/keys/parse-pkcs8.md) — Parses a PKCS#8 `PrivateKeyInfo` per RFC 5208 §5 — also accepts the RFC 5958 `OneAsymmetricKey` shape, which adds optio…
+ [parse-spki](./src/keys/parse-spki.md) — Parses an X.509 `SubjectPublicKeyInfo` per RFC 5280 §4.1 + Appendix A and unwraps the inner PKCS#1 `RSAPublicKey`. SPKI…
+ [parse](./src/keys/parse.md) — Public dispatcher entry-point unifying the four key-format parsers (PKCS#1, SPKI, PKCS#8, JWK) under one ergonomic call…
+ [serialize-jwk](./src/keys/serialize-jwk.md) — Inverse of `parseRsaPublicKeyJwk` and `parseRsaPrivateKeyJwk`. Emits an `RsaJwk` with every numeric field encoded as ba…
+ [serialize-pkcs1-private](./src/keys/serialize-pkcs1-private.md) — Inverse of `parseRsaPrivateKeyPkcs1`. Emits a DER `RSAPrivateKey` SEQUENCE per RFC 8017 Appendix A.1.2 from a canonical…
+ [serialize-pkcs1-public](./src/keys/serialize-pkcs1-public.md) — Inverse of `parseRsaPublicKeyPkcs1`. Emits a DER `RSAPublicKey` SEQUENCE per RFC 8017 Appendix A.1.1 from a canonical `…
+ [serialize-pkcs8](./src/keys/serialize-pkcs8.md) — Inverse of `parseRsaPrivateKeyPkcs8`. Wraps a serialised PKCS#1 `RSAPrivateKey` in a DER `PrivateKeyInfo` per RFC 5208…
+ [serialize-spki](./src/keys/serialize-spki.md) — Inverse of `parseRsaPublicKeySpki`. Wraps a serialised PKCS#1 `RSAPublicKey` in a DER `SubjectPublicKeyInfo` per RFC 52…
+ [serialize](./src/keys/serialize.md) — Public dispatcher entry-point inverse of `parse`. Selects the per-format serialiser via the same `format` discriminator…
+ [crt](./src/math/crt.md) — RSA private-key operation via the Chinese Remainder Theorem (RFC 8017 §5.1.2, second-form algorithm). Computes `m = c^d…
+ [i2osp](./src/math/i2osp.md) — Integer-to-Octet-String Primitive (RFC 8017 §4.1). Encodes a non-negative integer as a fixed-length big-endian byte str…
+ [modpow](./src/math/modpow.md) — Single-source-of-truth modular exponentiation for the entire `@suaveplan/crypto-rsa` package. Wraps `@noble/curves/abst…
+ [os2ip](./src/math/os2ip.md) — Octet-String-to-Integer Primitive (RFC 8017 §4.2). Decodes a big-endian byte string into a non-negative `bigint`. Used…
+ [metrics](./src/observability/metrics.md) — OpenTelemetry meter + instrument registry for `@suaveplan/crypto-rsa`. defines the full instrument set the prop…
+ [timing](./src/observability/timing.md) — Centralised high-resolution clock source used by every metric histogram in `@suaveplan/crypto-rsa`. Resolves to `perfor…
+ [labels](./src/pem/labels.md) — Centralised PEM textual labels per RFC 7468 §5/§10/§11 used by the public and private PEM parsers and serialisers in th…
+ [parse-private](./src/pem/parse-private.md) — Parse an RSA private key from RFC 7468 PEM textual encoding. Accepts the two canonical private-key armor labels — `"PRI…
+ [parse-public](./src/pem/parse-public.md) — Parse an RSA public key from RFC 7468 PEM textual encoding. Accepts both canonical armor labels — `"PUBLIC KEY"` (SPKI…
+ [pem-codec](./src/pem/pem-codec.md) — Underlying RFC 7468 textual-encoding codec used by the four PEM parse/serialise entry points in this module. Splits the…
+ [serialize-private](./src/pem/serialize-private.md) — Inverse of `parseRsaPrivateKeyPem`. Emits PEM textual encoding for an RSA private key in either PKCS#8 (`"PRIVATE KEY"`…
+ [serialize-public](./src/pem/serialize-public.md) — Inverse of `parseRsaPublicKeyPem`. Emits PEM textual encoding for an RSA public key in either SPKI (`"PUBLIC KEY"`, the…
+ [policy](./src/policy/modulus.md) — <!-- begin:auto-docs --> _(no submodules)_+ [modulus](./src/policy/modulus.md) — <!-- begin:auto-docs --> _(no submodules)_+ [profile](./src/profile/profile.md) — <!-- begin:auto-docs --> _(no submodules)_+ [profile](./src/profile/profile.md) — <!-- begin:auto-docs --> _(no submodules)_+ [schemas](./src/schemas/schemas.md) — <!-- begin:auto-docs --> _(no submodules)_+ [schemas](./src/schemas/schemas.md) — <!-- begin:auto-docs --> _(no submodules)_+ [pkcs1v15](./src/sign/pkcs1v15.md) — RSASSA-PKCS1-v1\_5 signature generation per RFC 8017 §8.2.1. Hashes the message with the configured algorithm, applies…
+ [pss](./src/sign/pss.md) — RSASSA-PSS signature generation per RFC 8017 §8.1.1. Hashes the message, draws a random salt of the configured length,…
+ [pkcs1v15](./src/verify/pkcs1v15.md) — RSASSA-PKCS1-v1\_5 signature verification per RFC 8017 §8.2.2. Recovers the encoded message from `signature` via `s^e m…
+ [pss](./src/verify/pss.md) — RSASSA-PSS signature verification per RFC 8017 §8.1.2. Recovers the encoded message via `s^e mod n`, then runs the EMSA…
+ [blinded_vs_unblinded_2048](./src/__benchmarks__/blinded_vs_unblinded_2048.md) — <!-- begin:auto-docs --> _(no submodules)_+ [rsa-2048-key](./src/__fixtures__/rsa-2048-key.md) — Real 2048-bit RSA keypair generated once at module-load time and exposed as canonical `RsaPublicKey` / `RsaPrivateKey`…
+ [test-keys](./src/__fixtures__/test-keys.md) — Tiny synthetic RSA keypair for unit tests that need an `RsaPrivateKey` / `RsaPublicKey` shape but don't need to run a r…
+ [reader](./src/asn1/reader.md) — Strict-DER reader scoped to the RSA key shapes defined in RFC 8017 Appendix A (PKCS#1), RFC 5280 §4.1 + Appendix A (`Su…
+ [writer](./src/asn1/writer.md) — Strict-DER encoder mirroring `asn1/reader`. Encodes the same minimal subset of ASN.1 needed to serialise RSA keys in PK…
+ [blinding](./src/blinding/blinding.md) — <!-- begin:auto-docs --> _(no submodules)_+ [blinding](./src/blinding/blinding.md) — <!-- begin:auto-docs --> _(no submodules)_+ [oaep](./src/decrypt/oaep.md) — RSAES-OAEP decryption per RFC 8017 §7.1.2 — counterpart to `encrypt/oaep`. Modern default for RSA public-key encryption.
+ [pkcs1v15](./src/decrypt/pkcs1v15.md) — RSAES-PKCS1-v1_5 decryption per RFC 8017 §7.2.2. Counterpart to `encrypt/pkcs1v15`. Provides legacy interop for protoco…
+ [emsa-pkcs1-v1_5](./src/encoding/emsa-pkcs1-v1_5.md) — Implements EMSA-PKCS1-v1\_5-ENCODE from RFC 8017 §9.2 — the encoding method underlying RSASSA-PKCS1-v1\_5 signatures. T…
+ [emsa-pss-encode](./src/encoding/emsa-pss-encode.md) — Implements the EMSA-PSS encoding operation defined in RFC 8017 §9.1.1. Given a message digest, an encoded-message bit l…
+ [emsa-pss-verify](./src/encoding/emsa-pss-verify.md) — Implements the EMSA-PSS verification operation defined in RFC 8017 §9.1.2. Given the message digest, the candidate enco…
+ [mgf1](./src/encoding/mgf1.md) — Implements the MGF1 mask-generation function defined in RFC 8017 §B.2.1. MGF1 is the building block used by EMSA-PSS an…
+ [default-rng](./src/encrypt/default-rng.md) — Single canonical adapter that lifts the `crypto.getRandomValues` CSPRNG into the `@suaveplan/types` `Rng` interface eve…
+ [oaep](./src/encrypt/oaep.md) — RSAES-OAEP encryption per RFC 8017 §7.1.1. The Optimal Asymmetric Encryption Padding (OAEP) scheme is the modern defaul…
+ [pkcs1v15](./src/encrypt/pkcs1v15.md) — RSAES-PKCS1-v1_5 encryption per RFC 8017 §7.2.1 — the legacy public-key encryption padding scheme historically used by…
+ [noble](./src/engine/noble.md) — Default `RsaCryptoEngine` backed by the pure-JS noble primitives this package ships natively. Provides the `name: "nobl…
+ [select](./src/engine/select.md) — Resolve the default `RsaCryptoEngine` for the host runtime. When `globalThis.crypto.subtle` exposes the RSA algorithms…
+ [subtle](./src/engine/subtle.md) — `RsaCryptoEngine` adapter over `globalThis.crypto.subtle`. When the host runtime exposes WebCrypto, this engine routes…
+ [errors](./src/errors/errors.md) — <!-- begin:auto-docs --> _(no submodules)_+ [errors](./src/errors/errors.md) — <!-- begin:auto-docs --> _(no submodules)_+ [format](./src/fingerprint/format.md) — Render a fingerprint byte sequence as a human- and machine-readable string. Provides four output formats covering every…
+ [spki](./src/fingerprint/spki.md) — Compute a deterministic fingerprint of an RSA public key by hashing its SPKI DER encoding (RFC 5280 §4.1 `SubjectPublic…
+ [registry](./src/handle/registry.md) — Process-wide registry for RSA key-handle providers. Every HSM, KMS, OS keychain, or PKCS#11 bridge registers a provider…
+ [software](./src/handle/software.md) — Reference `RsaKeyHandleProvider` wrapping in-memory `RsaPrivateKey` values. Implements the same interface as a real HSM…
+ [thumbprint-uri](./src/jwk/thumbprint-uri.md) — Compute the JWK Thumbprint URI per RFC 9278 §3 — the canonical `urn:ietf:params:oauth:jwk-thumbprint:<hash-alg>:<base64…
+ [thumbprint](./src/jwk/thumbprint.md) — Compute the JWK Thumbprint of an RSA public key per RFC 7638 §3.2. The thumbprint is a deterministic hash over the cano…
+ [exponent](./src/keygen/exponent.md) — Public-exponent validation for RSA key generation. The `e`-only constraints (odd, `> 1`, `< 2^256`) live here so they c…
+ [generate](./src/keygen/generate.md) — RSA key-pair generation per NIST FIPS 186-5 Appendix A.1 and SP 800-56B Rev. 2 §6.3. Two-prime by default; multi-prime…
+ [miller-rabin](./src/keygen/miller-rabin.md) — Probable-prime test per NIST FIPS 186-5 Appendix B.3.1, used by `generateRsaKeyPair` to qualify candidate primes during…
+ [multi-prime](./src/keygen/multi-prime.md) — Multi-prime RSA key generation per RFC 8017 §3 and PKCS #1 Appendix A.1.2 `OtherPrimeInfos` extension. Reachable via th…
+ [jwk-policy](./src/keys/jwk-policy.md) — Cross-check a JWK's `key_ops`, `use`, and `alg` members against the requested operation per RFC 7517 §4.2 / §4.3 / §4.4…
+ [oid](./src/keys/oid.md) — Centralised OID constants for the RSA wire formats handled by this package. Currently exports `OID_RSA_ENCRYPTION` (`1.…
+ [parse-jwk](./src/keys/parse-jwk.md) — Parses RSA JWKs per RFC 7517 §6.3.1 (public) and §6.3.2 (private). Accepts the JWK as a plain JS object literal, as a J…
+ [parse-pkcs1-private](./src/keys/parse-pkcs1-private.md) — Parses a DER-encoded `RSAPrivateKey` per RFC 8017 Appendix A.1.2 into the canonical `RsaPrivateKey` shape with mandator…
+ [parse-pkcs1-public](./src/keys/parse-pkcs1-public.md) — Parses a DER-encoded `RSAPublicKey ::= SEQUENCE { modulus INTEGER, publicExponent INTEGER }` per RFC 8017 Appendix A.1.…
+ [parse-pkcs8](./src/keys/parse-pkcs8.md) — Parses a PKCS#8 `PrivateKeyInfo` per RFC 5208 §5 — also accepts the RFC 5958 `OneAsymmetricKey` shape, which adds optio…
+ [parse-spki](./src/keys/parse-spki.md) — Parses an X.509 `SubjectPublicKeyInfo` per RFC 5280 §4.1 + Appendix A and unwraps the inner PKCS#1 `RSAPublicKey`. SPKI…
+ [parse](./src/keys/parse.md) — Public dispatcher entry-point unifying the four key-format parsers (PKCS#1, SPKI, PKCS#8, JWK) under one ergonomic call…
+ [serialize-jwk](./src/keys/serialize-jwk.md) — Inverse of `parseRsaPublicKeyJwk` and `parseRsaPrivateKeyJwk`. Emits an `RsaJwk` with every numeric field encoded as ba…
+ [serialize-pkcs1-private](./src/keys/serialize-pkcs1-private.md) — Inverse of `parseRsaPrivateKeyPkcs1`. Emits a DER `RSAPrivateKey` SEQUENCE per RFC 8017 Appendix A.1.2 from a canonical…
+ [serialize-pkcs1-public](./src/keys/serialize-pkcs1-public.md) — Inverse of `parseRsaPublicKeyPkcs1`. Emits a DER `RSAPublicKey` SEQUENCE per RFC 8017 Appendix A.1.1 from a canonical `…
+ [serialize-pkcs8](./src/keys/serialize-pkcs8.md) — Inverse of `parseRsaPrivateKeyPkcs8`. Wraps a serialised PKCS#1 `RSAPrivateKey` in a DER `PrivateKeyInfo` per RFC 5208…
+ [serialize-spki](./src/keys/serialize-spki.md) — Inverse of `parseRsaPublicKeySpki`. Wraps a serialised PKCS#1 `RSAPublicKey` in a DER `SubjectPublicKeyInfo` per RFC 52…
+ [serialize](./src/keys/serialize.md) — Public dispatcher entry-point inverse of `parse`. Selects the per-format serialiser via the same `format` discriminator…
+ [crt](./src/math/crt.md) — RSA private-key operation via the Chinese Remainder Theorem (RFC 8017 §5.1.2, second-form algorithm). Computes `m = c^d…
+ [i2osp](./src/math/i2osp.md) — Integer-to-Octet-String Primitive (RFC 8017 §4.1). Encodes a non-negative integer as a fixed-length big-endian byte str…
+ [modpow](./src/math/modpow.md) — Single-source-of-truth modular exponentiation for the entire `@suaveplan/crypto-rsa` package. Wraps `@noble/curves/abst…
+ [os2ip](./src/math/os2ip.md) — Octet-String-to-Integer Primitive (RFC 8017 §4.2). Decodes a big-endian byte string into a non-negative `bigint`. Used…
+ [metrics](./src/observability/metrics.md) — OpenTelemetry meter + instrument registry for `@suaveplan/crypto-rsa`. defines the full instrument set the prop…
+ [timing](./src/observability/timing.md) — Centralised high-resolution clock source used by every metric histogram in `@suaveplan/crypto-rsa`. Resolves to `perfor…
+ [labels](./src/pem/labels.md) — Centralised PEM textual labels per RFC 7468 §5/§10/§11 used by the public and private PEM parsers and serialisers in th…
+ [parse-private](./src/pem/parse-private.md) — Parse an RSA private key from RFC 7468 PEM textual encoding. Accepts the two canonical private-key armor labels — `"PRI…
+ [parse-public](./src/pem/parse-public.md) — Parse an RSA public key from RFC 7468 PEM textual encoding. Accepts both canonical armor labels — `"PUBLIC KEY"` (SPKI…
+ [pem-codec](./src/pem/pem-codec.md) — Underlying RFC 7468 textual-encoding codec used by the four PEM parse/serialise entry points in this module. Splits the…
+ [serialize-private](./src/pem/serialize-private.md) — Inverse of `parseRsaPrivateKeyPem`. Emits PEM textual encoding for an RSA private key in either PKCS#8 (`"PRIVATE KEY"`…
+ [serialize-public](./src/pem/serialize-public.md) — Inverse of `parseRsaPublicKeyPem`. Emits PEM textual encoding for an RSA public key in either SPKI (`"PUBLIC KEY"`, the…
+ [policy](./src/policy/modulus.md) — <!-- begin:auto-docs --> _(no submodules)_+ [modulus](./src/policy/modulus.md) — <!-- begin:auto-docs --> _(no submodules)_+ [profile](./src/profile/profile.md) — <!-- begin:auto-docs --> _(no submodules)_+ [profile](./src/profile/profile.md) — <!-- begin:auto-docs --> _(no submodules)_+ [schemas](./src/schemas/schemas.md) — <!-- begin:auto-docs --> _(no submodules)_+ [schemas](./src/schemas/schemas.md) — <!-- begin:auto-docs --> _(no submodules)_+ [pkcs1v15](./src/sign/pkcs1v15.md) — RSASSA-PKCS1-v1\_5 signature generation per RFC 8017 §8.2.1. Hashes the message with the configured algorithm, applies…
+ [pss](./src/sign/pss.md) — RSASSA-PSS signature generation per RFC 8017 §8.1.1. Hashes the message, draws a random salt of the configured length,…
+ [pkcs1v15](./src/verify/pkcs1v15.md) — RSASSA-PKCS1-v1\_5 signature verification per RFC 8017 §8.2.2. Recovers the encoded message from `signature` via `s^e m…
+ [pss](./src/verify/pss.md) — RSASSA-PSS signature verification per RFC 8017 §8.1.2. Recovers the encoded message via `s^e mod n`, then runs the EMSA…
+ [blinded_vs_unblinded_2048](./src/__benchmarks__/blinded_vs_unblinded_2048.md) — <!-- begin:auto-docs --> _(no submodules)_+ [rsa-2048-key](./src/__fixtures__/rsa-2048-key.md) — Real 2048-bit RSA keypair generated once at module-load time and exposed as canonical `RsaPublicKey` / `RsaPrivateKey`…
+ [test-keys](./src/__fixtures__/test-keys.md) — Tiny synthetic RSA keypair for unit tests that need an `RsaPrivateKey` / `RsaPublicKey` shape but don't need to run a r…
+ [reader](./src/asn1/reader.md) — Strict-DER reader scoped to the RSA key shapes defined in RFC 8017 Appendix A (PKCS#1), RFC 5280 §4.1 + Appendix A (`Su…
+ [writer](./src/asn1/writer.md) — Strict-DER encoder mirroring `asn1/reader`. Encodes the same minimal subset of ASN.1 needed to serialise RSA keys in PK…
+ [blinding](./src/blinding/blinding.md) — <!-- begin:auto-docs --> _(no submodules)_ + [blinding](./src/blinding/blinding.md) — <!-- begin:auto-docs --> _(no submodules)_+ [oaep](./src/decrypt/oaep.md) — RSAES-OAEP decryption per RFC 8017 §7.1.2 — counterpart to `encrypt/oaep`. Modern default for RSA public-key encryption.
+ [pkcs1v15](./src/decrypt/pkcs1v15.md) — RSAES-PKCS1-v1_5 decryption per RFC 8017 §7.2.2. Counterpart to `encrypt/pkcs1v15`. Provides legacy interop for protoco…
+ [emsa-pkcs1-v1_5](./src/encoding/emsa-pkcs1-v1_5.md) — Implements EMSA-PKCS1-v1\_5-ENCODE from RFC 8017 §9.2 — the encoding method underlying RSASSA-PKCS1-v1\_5 signatures. T…
+ [emsa-pss-encode](./src/encoding/emsa-pss-encode.md) — Implements the EMSA-PSS encoding operation defined in RFC 8017 §9.1.1. Given a message digest, an encoded-message bit l…
+ [emsa-pss-verify](./src/encoding/emsa-pss-verify.md) — Implements the EMSA-PSS verification operation defined in RFC 8017 §9.1.2. Given the message digest, the candidate enco…
+ [mgf1](./src/encoding/mgf1.md) — Implements the MGF1 mask-generation function defined in RFC 8017 §B.2.1. MGF1 is the building block used by EMSA-PSS an…
+ [default-rng](./src/encrypt/default-rng.md) — Single canonical adapter that lifts the `crypto.getRandomValues` CSPRNG into the `@suaveplan/types` `Rng` interface eve…
+ [oaep](./src/encrypt/oaep.md) — RSAES-OAEP encryption per RFC 8017 §7.1.1. The Optimal Asymmetric Encryption Padding (OAEP) scheme is the modern defaul…
+ [pkcs1v15](./src/encrypt/pkcs1v15.md) — RSAES-PKCS1-v1_5 encryption per RFC 8017 §7.2.1 — the legacy public-key encryption padding scheme historically used by…
+ [noble](./src/engine/noble.md) — Default `RsaCryptoEngine` backed by the pure-JS noble primitives this package ships natively. Provides the `name: "nobl…
+ [select](./src/engine/select.md) — Resolve the default `RsaCryptoEngine` for the host runtime. When `globalThis.crypto.subtle` exposes the RSA algorithms…
+ [subtle](./src/engine/subtle.md) — `RsaCryptoEngine` adapter over `globalThis.crypto.subtle`. When the host runtime exposes WebCrypto, this engine routes…
+ [errors](./src/errors/errors.md) — <!-- begin:auto-docs --> _(no submodules)_ + [errors](./src/errors/errors.md) — <!-- begin:auto-docs --> _(no submodules)_+ [format](./src/fingerprint/format.md) — Render a fingerprint byte sequence as a human- and machine-readable string. Provides four output formats covering every…
+ [spki](./src/fingerprint/spki.md) — Compute a deterministic fingerprint of an RSA public key by hashing its SPKI DER encoding (RFC 5280 §4.1 `SubjectPublic…
+ [registry](./src/handle/registry.md) — Process-wide registry for RSA key-handle providers. Every HSM, KMS, OS keychain, or PKCS#11 bridge registers a provider…
+ [software](./src/handle/software.md) — Reference `RsaKeyHandleProvider` wrapping in-memory `RsaPrivateKey` values. Implements the same interface as a real HSM…
+ [thumbprint-uri](./src/jwk/thumbprint-uri.md) — Compute the JWK Thumbprint URI per RFC 9278 §3 — the canonical `urn:ietf:params:oauth:jwk-thumbprint:<hash-alg>:<base64…
+ [thumbprint](./src/jwk/thumbprint.md) — Compute the JWK Thumbprint of an RSA public key per RFC 7638 §3.2. The thumbprint is a deterministic hash over the cano…
+ [exponent](./src/keygen/exponent.md) — Public-exponent validation for RSA key generation. The `e`-only constraints (odd, `> 1`, `< 2^256`) live here so they c…
+ [generate](./src/keygen/generate.md) — RSA key-pair generation per NIST FIPS 186-5 Appendix A.1 and SP 800-56B Rev. 2 §6.3. Two-prime by default; multi-prime…
+ [miller-rabin](./src/keygen/miller-rabin.md) — Probable-prime test per NIST FIPS 186-5 Appendix B.3.1, used by `generateRsaKeyPair` to qualify candidate primes during…
+ [multi-prime](./src/keygen/multi-prime.md) — Multi-prime RSA key generation per RFC 8017 §3 and PKCS #1 Appendix A.1.2 `OtherPrimeInfos` extension. Reachable via th…
+ [jwk-policy](./src/keys/jwk-policy.md) — Cross-check a JWK's `key_ops`, `use`, and `alg` members against the requested operation per RFC 7517 §4.2 / §4.3 / §4.4…
+ [oid](./src/keys/oid.md) — Centralised OID constants for the RSA wire formats handled by this package. Currently exports `OID_RSA_ENCRYPTION` (`1.…
+ [parse-jwk](./src/keys/parse-jwk.md) — Parses RSA JWKs per RFC 7517 §6.3.1 (public) and §6.3.2 (private). Accepts the JWK as a plain JS object literal, as a J…
+ [parse-pkcs1-private](./src/keys/parse-pkcs1-private.md) — Parses a DER-encoded `RSAPrivateKey` per RFC 8017 Appendix A.1.2 into the canonical `RsaPrivateKey` shape with mandator…
+ [parse-pkcs1-public](./src/keys/parse-pkcs1-public.md) — Parses a DER-encoded `RSAPublicKey ::= SEQUENCE { modulus INTEGER, publicExponent INTEGER }` per RFC 8017 Appendix A.1.…
+ [parse-pkcs8](./src/keys/parse-pkcs8.md) — Parses a PKCS#8 `PrivateKeyInfo` per RFC 5208 §5 — also accepts the RFC 5958 `OneAsymmetricKey` shape, which adds optio…
+ [parse-spki](./src/keys/parse-spki.md) — Parses an X.509 `SubjectPublicKeyInfo` per RFC 5280 §4.1 + Appendix A and unwraps the inner PKCS#1 `RSAPublicKey`. SPKI…
+ [parse](./src/keys/parse.md) — Public dispatcher entry-point unifying the four key-format parsers (PKCS#1, SPKI, PKCS#8, JWK) under one ergonomic call…
+ [serialize-jwk](./src/keys/serialize-jwk.md) — Inverse of `parseRsaPublicKeyJwk` and `parseRsaPrivateKeyJwk`. Emits an `RsaJwk` with every numeric field encoded as ba…
+ [serialize-pkcs1-private](./src/keys/serialize-pkcs1-private.md) — Inverse of `parseRsaPrivateKeyPkcs1`. Emits a DER `RSAPrivateKey` SEQUENCE per RFC 8017 Appendix A.1.2 from a canonical…
+ [serialize-pkcs1-public](./src/keys/serialize-pkcs1-public.md) — Inverse of `parseRsaPublicKeyPkcs1`. Emits a DER `RSAPublicKey` SEQUENCE per RFC 8017 Appendix A.1.1 from a canonical `…
+ [serialize-pkcs8](./src/keys/serialize-pkcs8.md) — Inverse of `parseRsaPrivateKeyPkcs8`. Wraps a serialised PKCS#1 `RSAPrivateKey` in a DER `PrivateKeyInfo` per RFC 5208…
+ [serialize-spki](./src/keys/serialize-spki.md) — Inverse of `parseRsaPublicKeySpki`. Wraps a serialised PKCS#1 `RSAPublicKey` in a DER `SubjectPublicKeyInfo` per RFC 52…
+ [serialize](./src/keys/serialize.md) — Public dispatcher entry-point inverse of `parse`. Selects the per-format serialiser via the same `format` discriminator…
+ [crt](./src/math/crt.md) — RSA private-key operation via the Chinese Remainder Theorem (RFC 8017 §5.1.2, second-form algorithm). Computes `m = c^d…
+ [i2osp](./src/math/i2osp.md) — Integer-to-Octet-String Primitive (RFC 8017 §4.1). Encodes a non-negative integer as a fixed-length big-endian byte str…
+ [modpow](./src/math/modpow.md) — Single-source-of-truth modular exponentiation for the entire `@suaveplan/crypto-rsa` package. Wraps `@noble/curves/abst…
+ [os2ip](./src/math/os2ip.md) — Octet-String-to-Integer Primitive (RFC 8017 §4.2). Decodes a big-endian byte string into a non-negative `bigint`. Used…
+ [metrics](./src/observability/metrics.md) — OpenTelemetry meter + instrument registry for `@suaveplan/crypto-rsa`. defines the full instrument set the prop…
+ [timing](./src/observability/timing.md) — Centralised high-resolution clock source used by every metric histogram in `@suaveplan/crypto-rsa`. Resolves to `perfor…
+ [labels](./src/pem/labels.md) — Centralised PEM textual labels per RFC 7468 §5/§10/§11 used by the public and private PEM parsers and serialisers in th…
+ [parse-private](./src/pem/parse-private.md) — Parse an RSA private key from RFC 7468 PEM textual encoding. Accepts the two canonical private-key armor labels — `"PRI…
+ [parse-public](./src/pem/parse-public.md) — Parse an RSA public key from RFC 7468 PEM textual encoding. Accepts both canonical armor labels — `"PUBLIC KEY"` (SPKI…
+ [pem-codec](./src/pem/pem-codec.md) — Underlying RFC 7468 textual-encoding codec used by the four PEM parse/serialise entry points in this module. Splits the…
+ [serialize-private](./src/pem/serialize-private.md) — Inverse of `parseRsaPrivateKeyPem`. Emits PEM textual encoding for an RSA private key in either PKCS#8 (`"PRIVATE KEY"`…
+ [serialize-public](./src/pem/serialize-public.md) — Inverse of `parseRsaPublicKeyPem`. Emits PEM textual encoding for an RSA public key in either SPKI (`"PUBLIC KEY"`, the…
+ [policy](./src/policy/modulus.md) — <!-- begin:auto-docs --> _(no submodules)_ + [modulus](./src/policy/modulus.md) — <!-- begin:auto-docs --> _(no submodules)_+ [profile](./src/profile/profile.md) — <!-- begin:auto-docs --> _(no submodules)_ + [profile](./src/profile/profile.md) — <!-- begin:auto-docs --> _(no submodules)_+ [schemas](./src/schemas/schemas.md) — <!-- begin:auto-docs --> _(no submodules)_ + [schemas](./src/schemas/schemas.md) — <!-- begin:auto-docs --> _(no submodules)_+ [pkcs1v15](./src/sign/pkcs1v15.md) — RSASSA-PKCS1-v1\_5 signature generation per RFC 8017 §8.2.1. Hashes the message with the configured algorithm, applies…
+ [pss](./src/sign/pss.md) — RSASSA-PSS signature generation per RFC 8017 §8.1.1. Hashes the message, draws a random salt of the configured length,…
+ [pkcs1v15](./src/verify/pkcs1v15.md) — RSASSA-PKCS1-v1\_5 signature verification per RFC 8017 §8.2.2. Recovers the encoded message from `signature` via `s^e m…
+ [pss](./src/verify/pss.md) — RSASSA-PSS signature verification per RFC 8017 §8.1.2. Recovers the encoded message via `s^e mod n`, then runs the EMSA…
## Install
```bash
bun add @suaveplan/crypto-rsa
```
## Quick start — parse and serialise
```ts
import {
parseRsaPublicKey,
parseRsaPublicKeyPem,
serializeRsaPublicKey,
serializeRsaPublicKeyPem,
} from "@suaveplan/crypto-rsa";
// PEM in, PEM out (round-trip).
const key = parseRsaPublicKeyPem(spkiPemString);
const back = serializeRsaPublicKeyPem(key); // -----BEGIN PUBLIC KEY-----…
// DER + JWK round-trips.
const der = serializeRsaPublicKey(key, { format: "spki" });
const jwk = serializeRsaPublicKey(key, { format: "jwk" });
const fromDer = parseRsaPublicKey(der as Uint8Array, { format: "spki" });
const fromJwk = parseRsaPublicKey(jwk, { format: "jwk" });
```
## Quick start — modulus policy
```ts
import { enforceMaxBitLength, enforceMinBitLength } from "@suaveplan/crypto-rsa/policy";
enforceMinBitLength(publicKey); // throws if < 2048 bits
enforceMinBitLength(legacyKey, { allowLegacy: true }); // accepts ≥ 1024 bits
enforceMaxBitLength(publicKey); // throws if > 16384 bits
```
## Quick start — math primitives
```ts
import {
modPow,
i2osp,
os2ip,
rsaPrivateOperationCrt,
} from "@suaveplan/crypto-rsa/math";
const c = os2ip(ciphertext);
const m = rsaPrivateOperationCrt(c, privateKey); // CRT-aware private op
const plaintext = i2osp(m, ciphertext.length);
const v = modPow(c, publicKey.e, publicKey.n); // public op
```
## Stage 1 modules
| Module | Doc |
| --- | --- |
| `asn1/reader` | [`src/asn1/reader.md`](src/asn1/reader.md) |
| `asn1/writer` | [`src/asn1/writer.md`](src/asn1/writer.md) |
| `errors/errors` | [`src/errors/errors.md`](src/errors/errors.md) |
| `keys/oid` | [`src/keys/oid.md`](src/keys/oid.md) |
| `keys/parse-pkcs1-public` | [`src/keys/parse-pkcs1-public.md`](src/keys/parse-pkcs1-public.md) |
| `keys/parse-pkcs1-private` | [`src/keys/parse-pkcs1-private.md`](src/keys/parse-pkcs1-private.md) |
| `keys/parse-spki` | [`src/keys/parse-spki.md`](src/keys/parse-spki.md) |
| `keys/parse-pkcs8` | [`src/keys/parse-pkcs8.md`](src/keys/parse-pkcs8.md) |
| `keys/parse-jwk` | [`src/keys/parse-jwk.md`](src/keys/parse-jwk.md) |
| `keys/parse` | [`src/keys/parse.md`](src/keys/parse.md) |
| `keys/serialize-pkcs1-public` | [`src/keys/serialize-pkcs1-public.md`](src/keys/serialize-pkcs1-public.md) |
| `keys/serialize-pkcs1-private` | [`src/keys/serialize-pkcs1-private.md`](src/keys/serialize-pkcs1-private.md) |
| `keys/serialize-spki` | [`src/keys/serialize-spki.md`](src/keys/serialize-spki.md) |
| `keys/serialize-pkcs8` | [`src/keys/serialize-pkcs8.md`](src/keys/serialize-pkcs8.md) |
| `keys/serialize-jwk` | [`src/keys/serialize-jwk.md`](src/keys/serialize-jwk.md) |
| `keys/serialize` | [`src/keys/serialize.md`](src/keys/serialize.md) |
| `math/modpow` | [`src/math/modpow.md`](src/math/modpow.md) |
| `math/i2osp` | [`src/math/i2osp.md`](src/math/i2osp.md) |
| `math/os2ip` | [`src/math/os2ip.md`](src/math/os2ip.md) |
| `math/crt` | [`src/math/crt.md`](src/math/crt.md) |
| `pem/labels` | [`src/pem/labels.md`](src/pem/labels.md) |
| `pem/pem-codec` | [`src/pem/pem-codec.md`](src/pem/pem-codec.md) |
| `pem/parse-public` | [`src/pem/parse-public.md`](src/pem/parse-public.md) |
| `pem/parse-private` | [`src/pem/parse-private.md`](src/pem/parse-private.md) |
| `pem/serialize-public` | [`src/pem/serialize-public.md`](src/pem/serialize-public.md) |
| `pem/serialize-private` | [`src/pem/serialize-private.md`](src/pem/serialize-private.md) |
| `policy/modulus` | [`src/policy/modulus.md`](src/policy/modulus.md) |
| `schemas/schemas` | [`src/schemas/schemas.md`](src/schemas/schemas.md) |
| `observability/metrics` | [`src/observability/metrics.md`](src/observability/metrics.md) |
## Stage 2 modules
| Module | Doc |
| --- | --- |
| `encoding/mgf1` | [`src/encoding/mgf1.md`](src/encoding/mgf1.md) |
| `encoding/emsa-pkcs1-v1_5` | [`src/encoding/emsa-pkcs1-v1_5.md`](src/encoding/emsa-pkcs1-v1_5.md) |
| `encoding/emsa-pss-encode` | [`src/encoding/emsa-pss-encode.md`](src/encoding/emsa-pss-encode.md) |
| `encoding/emsa-pss-verify` | [`src/encoding/emsa-pss-verify.md`](src/encoding/emsa-pss-verify.md) |
| `sign/pkcs1v15` | [`src/sign/pkcs1v15.md`](src/sign/pkcs1v15.md) |
| `sign/pss` | [`src/sign/pss.md`](src/sign/pss.md) |
| `verify/pkcs1v15` | [`src/verify/pkcs1v15.md`](src/verify/pkcs1v15.md) |
| `verify/pss` | [`src/verify/pss.md`](src/verify/pss.md) |
| `observability/timing` | [`src/observability/timing.md`](src/observability/timing.md) |
## Stage 3 modules
| Module | Doc |
| --- | --- |
| `blinding/blinding` | [`src/blinding/blinding.md`](src/blinding/blinding.md) |
| `encrypt/pkcs1v15` | [`src/encrypt/pkcs1v15.md`](src/encrypt/pkcs1v15.md) |
| `encrypt/oaep` | [`src/encrypt/oaep.md`](src/encrypt/oaep.md) |
| `encrypt/default-rng` | [`src/encrypt/default-rng.md`](src/encrypt/default-rng.md) |
| `decrypt/pkcs1v15` | [`src/decrypt/pkcs1v15.md`](src/decrypt/pkcs1v15.md) |
| `decrypt/oaep` | [`src/decrypt/oaep.md`](src/decrypt/oaep.md) |
| `keygen/generate` | [`src/keygen/generate.md`](src/keygen/generate.md) |
| `keygen/miller-rabin` | [`src/keygen/miller-rabin.md`](src/keygen/miller-rabin.md) |
| `keygen/exponent` | [`src/keygen/exponent.md`](src/keygen/exponent.md) |
| `keygen/multi-prime` | [`src/keygen/multi-prime.md`](src/keygen/multi-prime.md) |
## Stage 4 modules
| Module | Doc |
| --- | --- |
| `jwk/thumbprint` | [`src/jwk/thumbprint.md`](src/jwk/thumbprint.md) |
| `jwk/thumbprint-uri` | [`src/jwk/thumbprint-uri.md`](src/jwk/thumbprint-uri.md) |
| `fingerprint/spki` | [`src/fingerprint/spki.md`](src/fingerprint/spki.md) |
| `fingerprint/format` | [`src/fingerprint/format.md`](src/fingerprint/format.md) |
| `engine/noble` | [`src/engine/noble.md`](src/engine/noble.md) |
| `engine/subtle` | [`src/engine/subtle.md`](src/engine/subtle.md) |
| `engine/select` | [`src/engine/select.md`](src/engine/select.md) |
| `handle/registry` | [`src/handle/registry.md`](src/handle/registry.md) |
| `handle/software` | [`src/handle/software.md`](src/handle/software.md) |
| `profile/profile` | [`src/profile/profile.md`](src/profile/profile.md) |
| `keys/jwk-policy` | [`src/keys/jwk-policy.md`](src/keys/jwk-policy.md) |
## Stage roadmap
+ __Stage 1__: ASN.1 / DER, key parse + serialise (PKCS#1, SPKI, PKCS#8, JWK, PEM),
modulus-length policy, math primitives, full error / observability registry.
+ __Stage 2__: MGF1, EMSA-PKCS1-v1_5, EMSA-PSS, sign / verify (RSASSA-PKCS1-v1_5 + PSS).
+ __Stage 3__: encrypt / decrypt (PKCS#1 v1.5 + OAEP), key generation (Miller-Rabin,
multi-prime), blinding (RFC 8017 §5.1.2 / Kocher 1996).
+ __Stage 4__ (this release): blinding wired into sign paths, JWK thumbprint (RFC 7638)
+ thumbprint URI (RFC 9278), SPKI fingerprint with four output formats,
`RsaCryptoEngine` adapter (noble + WebCrypto subtle + auto-selector), `RsaKeyHandle`
HSM bridge with reference `SoftwareRsaKeyHandleProvider`, FIPS 186-5 profile,
JWK `key_ops` / `use` / `alg` enforcement.
## License
MIT