/usr/lib/swipl/library/ext/ssl/crypto.pl
All Application Manual Name SummaryHelp

  • ext
    • ssl
      • ssl.pl -- Secure Socket Layer (SSL) library
      • crypto.pl -- Cryptography and authentication library
        • crypto_n_random_bytes/2
        • crypto_data_hash/3
        • crypto_file_hash/3
        • crypto_context_new/2
        • crypto_data_context/3
        • crypto_context_hash/2
        • crypto_open_hash_stream/3
        • crypto_stream_hash/2
        • crypto_password_hash/2
        • crypto_password_hash/3
        • crypto_data_hkdf/4
        • ecdsa_sign/4
        • ecdsa_verify/4
        • hex_bytes/2
        • rsa_private_decrypt/4
        • rsa_private_encrypt/4
        • rsa_public_decrypt/4
        • rsa_public_encrypt/4
        • rsa_sign/4
        • rsa_verify/4
        • crypto_data_decrypt/6
        • crypto_data_encrypt/6
        • crypto_modular_inverse/3
        • crypto_generate_prime/3
        • crypto_is_prime/2
        • crypto_name_curve/2
        • crypto_curve_order/2
        • crypto_curve_generator/2
        • crypto_curve_scalar_mult/4
      • xmlenc.pl -- XML encryption library
      • xmldsig.pl -- XML Digital signature
 rsa_private_decrypt(+PrivateKey, +CipherText, -PlainText, +Options) is det
 rsa_private_encrypt(+PrivateKey, +PlainText, -CipherText, +Options) is det
 rsa_public_decrypt(+PublicKey, +CipherText, -PlainText, +Options) is det
 rsa_public_encrypt(+PublicKey, +PlainText, -CipherText, +Options) is det
RSA Public key encryption and decryption primitives. A string can be safely communicated by first encrypting it and have the peer decrypt it with the matching key and predicate. The length of the string is limited by the key length.

Options:

encoding(+Encoding)
Encoding to use for Data. Default is utf8. Alternatives are utf8 and octet.
padding(+PaddingScheme)
Padding scheme to use. Default is pkcs1. Alternatives are pkcs1_oaep, sslv23 and none. Note that none should only be used if you implement cryptographically sound padding modes in your application code as encrypting unpadded data with RSA is insecure
Errors
- ssl_error(Code, LibName, FuncName, Reason) is raised if there is an error, e.g., if the text is too long for the key.
See also
- load_private_key/3, load_public_key/2 can be use to load keys from a file. The predicate load_certificate/2 can be used to obtain the public key from a certificate.