Parameters to be used to call publickey:generatekey/1, to generate a key, or an existing key. Defaults to generating an ECDSA key. Note this could fail if Erlang/OTP is compiled with a very old cryptolib. If you need cryptographically strong random numbers use randseedalgs/1 with Alg =:= crypto or Alg =:= cryptocache. If you need to be able to repeat the sequence use this function. If you do not need the statistical quality of this function, there are faster algorithms in the rand module. RSA is available with all OpenSSL versions compatible with Erlang CRYPTO if not disabled by configuration. To dynamically check availability, check that the atom rsa is present in the list with the publickeys tag in the return value of crypto:supports. RSA is available with all OpenSSL versions compatible with Erlang CRYPTO if not disabled by configuration. To dynamically check availability, check that the atom rsa is present in the list with the publickeys tag in the return value of crypto:supports. It seems like Erlang already has a function that does this for you called publickey:pemdecode which should just take the entire openssl generated key. According to the documentation it should also parse private keys. As I'm not a Erlang programmer I cannot test this easily, so please let me know.
You may generate an RSA private key with the help of this tool. Additionally, it will display the public key of a generated or pasted private key.
Description
RSA is an asymmetric encryption algorithm. With a given key pair, data that is encrypted with one key can only be decrypted by the other. This is useful for encrypting data between a large number of parties; only one key pair per person need exist. RSA is widely used across the internet with HTTPS.
To generate a key pair, select the bit length of your key pair and click Generate key pair. Depending on length, your browser may take a long time to generate the key pair. A 1024-bit key will usually be ready instantly, while a 4096-bit key may take up to several minutes. For a faster and more secure method, see Do It Yourself below.
CryptoTools.net does not yet have a tool for facilitating the encryption and decryption of data using RSA, but you may Do It Yourself with the instructions below.
Do It Yourself
Erlang Crypto Generate_key Rsa 1
For these steps, you will need a command line shell with OpenSSL. Ideally, you should have a private key of your own and a public key from someone else. For demonstration, we will only use a single key pair.
Generate Private Key
Run this command to generate a 4096-bit private key and output it to the private.pem file. If you like, you may change the key length and/or output file.
Derive Public Key
Erlang Crypto Generate_key Rsa Login
Given a private key, you may derive its public key and output it to public.pem using this command. (You may also paste your OpenSSL-generated private key into the form above to get its public key.)
Encrypt Data
We can now use this key pair to encrypt and decrypt a file, data.txt.
Decrypt Data
Erlang Crypto Generate_key Rsa Calculator
Given the encrypted file from the previous step, you may decrypt it like so.