# react-native-fast-rsa **Repository Path**: appplugin/react-native-fast-rsa ## Basic Information - **Project Name**: react-native-fast-rsa - **Description**: 来源 https://github.com/jerson/react-native-fast-rsa - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-02-28 - **Last Updated**: 2024-02-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # react-native-fast-rsa 来源 https://github.com/jerson/react-native-fast-rsa ## Getting started `$ yarn add react-native-fast-rsa` ## JSI If you want to use with `JSI` instead of `NativeModules` you need to set ```typescript import RSA from "react-native-fast-rsa"; RSA.useJSI = true; ``` if you need to use generate methods it is a good idea to disable it, because for now JSI will block your UI but it is faster compared to NativeModules ## Usage ```typescript export interface PCKS12KeyPair { publicKey: string; privateKey: string; certificate: string; } export interface KeyPair { publicKey: string; privateKey: string; } export enum Hash { MD5 = 0, SHA1 = 1, SHA224 = 2, SHA256 = 3, SHA384 = 4, SHA512 = 5, } export enum PEMCipher { DES = 0, D3DES = 1, AES128 = 2, AES192 = 3, AES256 = 4, } export enum SaltLength { AUTO = 0, EQUALS_HASH = 1, } class RSA { static convertJWKToPrivateKey(data: any, keyId: string): Promise static convertJWKToPublicKey(data: any, keyId: string): Promise static convertKeyPairToPKCS12(privateKey: string, certificate: string, password: string): Promise static convertPKCS12ToKeyPair(pkcs12: string, password: string,): Promise static convertPrivateKeyToPKCS8(privateKey: string,): Promise static convertPrivateKeyToPKCS1(privateKey: string): Promise static convertPrivateKeyToJWK(privateKey: string): Promise static convertPrivateKeyToPublicKey(privateKey: string): Promise static convertPublicKeyToPKIX(publicKey: string): Promise static convertPublicKeyToPKCS1(publicKey: string): Promise static convertPublicKeyToJWK(publicKey: string): Promise static decryptPrivateKey(privateKeyEncrypted: string, password: string,): Promise static encryptPrivateKey(privateKey: string, password: string, cipherName: Cipher): Promise static decryptOAEP(message: string, label: string, hashName: Hash, privateKey: string): Promise static decryptPKCS1v15(message: string, privateKey: string,): Promise static encryptOAEP(message: string,label: string, hashName: Hash, publicKey: string): Promise static encryptPKCS1v15(message: string, publicKey: string): Promise static signPSS(message: string, hashName: Hash, saltLengthName: SaltLength, privateKey: string): Promise static signPKCS1v15(message: string, hashName: Hash, privateKey: string): Promise static verifyPSS(signature: string, message: string, hashName: Hash, saltLengthName: SaltLength, publicKey: string): Promise static verifyPKCS1v15(signature: string, message: string, hashName: Hash, publicKey: string): Promise static hash(message: string, name: Hash): Promise static base64(message: string): Promise static generate(bits: number): Promise } ```