OpenVAS Scanner
7.0.0~git
|
#include "nasl_lex_ctxt.h"
Go to the source code of this file.
int generate_script_signature | ( | char * | ) |
Definition at line 1829 of file nasl_crypto2.c.
References encrypt_data().
Definition at line 1841 of file nasl_crypto2.c.
References encrypt_data().
Definition at line 1859 of file nasl_crypto2.c.
References encrypt_data().
Definition at line 1835 of file nasl_crypto2.c.
References encrypt_data().
Definition at line 1847 of file nasl_crypto2.c.
References encrypt_data().
Definition at line 1865 of file nasl_crypto2.c.
References encrypt_data().
nasl function
bf_cbc_decrypt(key:key, iv:iv, data:data)
Decrypt the cipher text data using the blowfish algorithm in CBC mode with the key key and the initialization vector iv. The key must be 16 bytes long. The iv must be at least 8 bytes long. data must be a multiple of 8 bytes long.
The return value is an array a with a[0] being the plaintext data and a[1] the new initialization vector to use for the next part of the data.
Definition at line 1518 of file nasl_crypto2.c.
References nasl_bf_cbc().
nasl function
bf_cbc_encrypt(key:key, iv:iv, data:data)
Encrypt the plaintext data using the blowfish algorithm in CBC mode with the key key and the initialization vector iv. The key must be 16 bytes long. The iv must be at least 8 bytes long. data must be a multiple of 8 bytes long.
The return value is an array a with a[0] being the encrypted data and a[1] the new initialization vector to use for the next part of the data.
Definition at line 1498 of file nasl_crypto2.c.
References nasl_bf_cbc().
nasl function
bn_cmp(key1:MPI1, key2:MPI2)
Compares the MPIs key1 and key2 (given as binary strings). Returns -1 if key1 < key2, 0 if key1 == key2 and +1 if key1 > key2.
Definition at line 285 of file nasl_crypto2.c.
References CONST_INT, TC::i_val, mpi_from_named_parameter(), TC::ref_count, TC::type, and TC::x.
nasl function
bn_random(need:numBits)
Definition at line 322 of file nasl_crypto2.c.
References alloc_typed_cell(), CONST_DATA, get_int_var_by_name(), set_mpi_retc(), TC::size, TC::str_val, and TC::x.
Nasl function to delete a cipher item from the cipher table.
[in] | cipher | The cipher algorithm. It must be the same used for the handler. It is used to prepare the data. Only GCRY_CIPHER_ARCFOUR is currently supported. |
Definition at line 1661 of file nasl_crypto2.c.
References alloc_typed_cell(), CONST_INT, delete_cipher_item(), get_int_var_by_name(), cipher_table_item::hd, TC::i_val, verify_cipher_id(), and TC::x.
Definition at line 1853 of file nasl_crypto2.c.
References encrypt_data().
nasl function
DH_compute_key(p:mpi_p, g:mpi_g, dh_server_pub:mpi_server_pub, pub_key:mpi_client_pub, priv_key:mpi_client_priv)
Computes the Diffie-Hellman shared secret key from the shared parameters p and g, the server's public key dh_server_pub and the client's public and private keys pub_key an priv_key. The return value is the shared secret key as an MPI.
Definition at line 619 of file nasl_crypto2.c.
References alloc_typed_cell(), calc_dh_key(), CONST_DATA, mpi_from_named_parameter(), set_mpi_retc(), TC::size, TC::str_val, and TC::x.
nasl function
dh_generate_key(p:mpi_p, g:mpi_g, priv:mpi_priv)
Generates a Diffie-Hellman public key from the shared parameters p and g and the private parameter priv. The return value is the public key as an MPI.
Definition at line 574 of file nasl_crypto2.c.
References alloc_typed_cell(), calc_dh_public(), CONST_DATA, mpi_from_named_parameter(), set_mpi_retc(), TC::size, TC::str_val, and TC::x.
nasl function
dsa_do_sign(p:mpi_p, g:mpi_g, q:mpi_q, pub:mpi_pub, priv:mpi_priv, data:hash)
Computes the DSA signature of the hash in data using the private DSA key given by p, g, q, pub and priv. The return value is a 40 byte string encoding the two MPIs r and s of the DSA signature. The first 20 bytes are the value of r and the last 20 bytes are the value of s.
Definition at line 1251 of file nasl_crypto2.c.
References CONST_DATA, extract_mpi_from_sexp(), TC::i_val, INTBLOB_LEN, mpi_from_named_parameter(), nasl_perror(), print_gcrypt_error(), TC::ref_count, SIGBLOB_LEN, TC::size, TC::str_val, TC::type, and TC::x.
nasl function
dsa_do_verify(p:mpi_p, g:mpi_g, q:mpi_q, pub:mpi_pub, r:mpi_r, s:mpi_s, data:hash)
Verify that the DSA signature given by r and s matches the hash given in data using the public DSA key given by p, g, q and pub. Returns 1 if the signature is valid and 0 if it's invalid.
Definition at line 1162 of file nasl_crypto2.c.
References CONST_INT, TC::i_val, mpi_from_named_parameter(), print_gcrypt_error(), TC::ref_count, TC::type, and TC::x.
Nasl function to open RC4 cipher to encrypt a stream of data. The handler can be used to encrypt stream data. Open cipher must be close with close_stream_cipher() when it is not useful anymore.
Definition at line 1822 of file nasl_crypto2.c.
References nasl_open_stream_cipher().
nasl function
pem_to_dsa(priv:PEM, passphrase:PASSPHRASE)
Reads the private key from the string priv which contains a private DSA key in PEM format. Passphrase is the passphrase needed to decrypt the private key. The function returns the parameter "x" of the DSA key as an MPI.
Definition at line 505 of file nasl_crypto2.c.
References nasl_pem_to().
nasl function
pem_to_rsa(priv:PEM, passphrase:PASSPHRASE)
Reads the private key from the string priv which contains a private RSA key in PEM format. Passphrase is the passphrase needed to decrypt the private key. The function returns the parameter "d" of the RSA key as an MPI.
Definition at line 489 of file nasl_crypto2.c.
References nasl_pem_to().
Nasl function to encrypt data with a RC4 cipher. If an hd param exist in the lexix context, it will use this handler to encrypt the data as part of a stream data. e.g.: rc4_encypt(data: data, hd: hd)
Otherwise encrypts the data as block and the key is mandatory: e.g.: rc4_encypt(data: data, key: key)
Definition at line 1796 of file nasl_crypto2.c.
References encrypt_data(), encrypt_stream_data(), get_int_var_by_name(), cipher_table_item::hd, and verify_cipher_id().
nasl function
rsa_private_decrypt(data:data, d:mpi_d, e:mpi_e, n:mpi_n, padd:<TRUE:FALSE>)
Decrypt the provided data with the private RSA key given by its parameters d, e and n. The return value is the decrypted data in plaintext format.
TODO: In future releases, string support for padding should be removed
Definition at line 862 of file nasl_crypto2.c.
References alloc_typed_cell(), CONST_DATA, get_int_var_by_name(), get_str_var_by_name(), get_var_type_by_name(), mpi_from_named_parameter(), nasl_perror(), print_gcrypt_error(), set_retc_from_sexp(), TC::size, TC::str_val, strip_pkcs1_padding(), VAR2_INT, VAR2_STRING, and TC::x.
nasl function
rsa_public_decrypt(sig:signature, e:mpi_e, n:mpi_n)
Decrypt the data in signature (usually an rsa-encrypted hash) with the public RSA key given by its parameters e and n. The return value is the decrypted data.
Definition at line 961 of file nasl_crypto2.c.
References alloc_typed_cell(), CONST_DATA, mpi_from_named_parameter(), print_gcrypt_error(), set_retc_from_sexp(), TC::size, TC::str_val, strip_pkcs1_padding(), and TC::x.
nasl function
rsa_public_encrypt(data:data, e:mpi_e, n:mpi_n, padd:<TRUE:FALSE>)
Encrypt the provided data with the public RSA key given by its parameters e and n. The return value is the encrypted data.
TODO: In future releases, string support for padding should be removed
Definition at line 770 of file nasl_crypto2.c.
References alloc_typed_cell(), CONST_DATA, get_int_var_by_name(), get_str_var_by_name(), get_var_type_by_name(), mpi_from_named_parameter(), nasl_perror(), print_gcrypt_error(), set_retc_from_sexp(), TC::size, TC::str_val, strip_pkcs1_padding(), VAR2_INT, VAR2_STRING, and TC::x.
nasl function
rsa_sign(data:hash, priv:pem, passphrase:passphrase)
Signs the data with the private RSA key priv given in PEM format. The passphrase is the passphrase needed to decrypt the private key. Returns the signed data.
In the OpenSSL based nasl, the key was not given in PEM form and with a passphrase. Instead it was given as the RSA parameters e, n and d. libgcrypt always requires all the parameters (including p, g, and u), so this function was changed to simply accept the full private key in PEM form. The one place where it was called had that the key available in that form.
Definition at line 1098 of file nasl_crypto2.c.
References alloc_typed_cell(), CONST_DATA, get_str_var_by_name(), get_var_size_by_name(), nasl_load_privkey_param(), nasl_sexp_from_privkey(), print_gcrypt_error(), set_retc_from_sexp(), TC::size, TC::str_val, and TC::x.