Skip to content

Error Not a base64-encoded string #2

@simarilius

Description

@simarilius

Works fine :)
Found a small issue for my case:
encryption in php -> decryption in javascript

Sometime I get an error: Not a base64-encoded string

Was a simple to fix:
Crypt.php changes Characters after base64_encode:

strtr($sBase64, '+/', '-_');

This has to be undone in crypt.js:
function decode64(text) {

text = text.replace(/\s/g, "");
text = text.replace(/-/g, '+');
text = text.replace(/_/g, '/');
if (!(/^[a-z0-9+/\s]+={0,2}$/i.test(text)) || text.length % 4 > 0) {
alert("Not a base64-encoded string.");
}

Most likely the same issue is in encode64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions