Skip to content

electron encrypt an error #1010

Description

@pengyinghao
/**
 * rsa加密
 * @param data 加密的字符串
 * @returns 但会一个加密的base64位字符串
 */
export const rasEncrypt = (data) => {
    if (!data) throw new Error('params "data" is null')
    const publicK = forge.pki.publicKeyFromPem(publicKey)
    const encrypted = publicK.encrypt(encodeURIComponent(data), 'RSA-OAEP', {
        md: forge.md.sha256.create(),
        mgf1: {
            md: forge.md.sha1.create()
        }
    })
    return window.btoa(encrypted)
}

An error occurred while encrypting,But it works fine on the browser side
image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions