Tutorial by Examples

// Create an array with a fixed size and type. var array = new Uint8Array(5); // Generate cryptographically random values crypto.getRandomValues(array); // Print the array to the console console.log(array); crypto.getRandomValues(array) can be used with instances of the following classes...
// Convert string to ArrayBuffer. This step is only necessary if you wish to hash a string, not if you aready got an ArrayBuffer such as an Uint8Array. var input = new TextEncoder('utf-8').encode('Hello world!'); // Calculate the SHA-256 digest crypto.subtle.digest('SHA-256', input) // Wait fo...
In this example you will learn how to generate RSA-OAEP key pair and how to convert private key from this key pair to base64 so you can use it with OpenSSL etc. Please note that this process can also be used for public key you just have to use prefix and suffix below: -----BEGIN PUBLIC KEY----- --...
So, have you ever wondered how to use your PEM RSA key pair that was generated by OpenSSL in Web Cryptography API? If the answers is yes. Great! You are going to find out. NOTE: This process can also be used for public key, you only need to change prefix and suffix to: -----BEGIN PUBLIC KEY----- ...

Page 1 of 1