Library rsa

To use this library in your code:

import crypto.rsa
Support for RSA (Rivest–Shamir–Adleman) public-key cryptography.
RSA can be used for both encryption, and digital signatures.
Examples
Signing and Verifying

import crypto.rsa

// Assuming 'private-key' and 'public-key' are available as rsa.RsaKey.

message := "Hello world"
key := rsa.RsaKey.generate --bits=2048
signature := key.sign message

if key.verify message signature:
  print "Signature is valid"
else:
  print "Signature is invalid"
Alternative hashing
If you need to use other hash algorithms (e.g. SHA-1):

signature := private-key.sign message --hash=rsa.RsaKey.SHA-1

Classes

A pair of RSA keys generated together.