-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbrowser-based-encryption.html
21 lines (17 loc) · 1.08 KB
/
browser-based-encryption.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<html>
//This example uses the JSEncrypt library.
//You may use any library you want for standard RSA encryption.
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsencrypt/2.3.1/jsencrypt.js"></script>
<script>
//the full card number accepted through your form
const cardNumber = '44441111';
//this is the sandbox public key provided by Nexio, contact integration support for a production key
const publicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvWpIQFjQQCPpaIlJKpeg irp5kLkzLB1AxHmnLk73D3TJbAGqr1QmlsWDBtMPMRpdzzUM7ZwX3kzhIuATV4Pe 7RKp3nZlVmcrT0YCQXBrTwqZNh775z58GP2kZs+gVfNqBampJPzSB/hB62KkByhE Cn6grrRjiAVwJyZVEvs/2vrxaEpO+aE16emtX12RgI5JdzdOiNyZEQteU6zRBRJE ocPWVxExaOpVVVJ5+UnW0LcalzA+lRGRTrQJ5JguAPiAOzRPTK/lYFFpCAl/F8wt oAVG1c8zO2NcQ0Pko+fmeidRFxJ/did2btV+9Mkze3mBphwFmvnxa35LF+Cs/XJHDwIDAQAB';
const crypt = new JSEncrypt();
crypt.setKey(publicKey);
//the encrypted card number
const encryptedNumber = crypt.encrypt(cardNumber);
console.log(encryptedNumber, '-------------')
//Send a POST request to Nexio.
</script>
</html>