js-crypto-key-utils
Version:
Universal Module for Cryptographic Key Utilities in JavaScript, including PEM-JWK converters
19 lines (18 loc) • 795 B
TypeScript
/**
* asn1rsa.js
*/
import { DecodedAsn1Key, PublicOrPrivate } from './typedef';
/**
* Encode RSA JWK key to ASN.1 DER or PEM of SPKI/OneAsymmetricKey.
* @param {JsonWebKey} jwk - A key object in JWK format to be encoded.
* @param {PublicOrPrivate} type - 'public' or 'private'.
* @returns {DecodedAsn1Key} - Parsed object of ASN.1 encoded key object.
*/
export declare const fromJwk: (jwk: JsonWebKey, type: PublicOrPrivate) => DecodedAsn1Key;
/**
* Convert RSA spki/pkcs8 public/private keys to JWK
* @param {Object} decoded - Parsed object of RSA key to be encoded.
* @param {PublicOrPrivate} type - 'public' or 'private'
* @return {JsonWebKey} - Encoded RSA key object in JWK format.
*/
export declare const toJwk: (decoded: DecodedAsn1Key, type: PublicOrPrivate) => JsonWebKey;