Skip to content

electron encrypt an error #1010

Open
@pengyinghao

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

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