skip to Main Content

Javascript – Is it correct to store RSA public key to .env file? If yes, how to store it with multiple line? otherwise, why?

Why am I consistently getting the error message "Data provided to an operation does not meet requirements" when using my own public key with window.crypto.subtle.importKey, but not with a generated public key? // .env file PUBLIC_KEY=$'-----BEGIN PUBLIC KEY-----nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDE70mr7SEMIvUuLKf1g3/UdIVTVnpD7niRC/P4eT+fkn7YN7xLv9Su5MJ1ths+W/IsP0LVC5k+ZOUSV62rMsmQrhgF0xz2kG1RfUpX0DfTzsYNzMKC5ydx3K1aomDent16SWSTmCXDtDIw+YOmwltVhV55zoD9ylOVlnvkj0NutQIDAQABn-----END PUBLIC KEY-----'…

VIEW QUESTION
Back To Top
Search