AFIT/Source/scalable/scalable_ciphers.ml

57 lines
1.7 KiB
OCaml

(** Ciphers
bitarrays based ciphers.
*)
open Scalable
open Scalable_basic_arithmetics
open Scalable_power
(********** RSA Cipher **********)
(** Generate an RSA ciphering key.
Involved prime bitarrays need to be distinct. Output is a couple
of public, private keys.
@param p prime bitarray
@param q prime bitarray
*)
let generate_keys_rsa p q = (([],[]), ([], []))
(** Encryption using RSA cryptosystem.
@param m bitarray hash of message
@param pub_key a tuple (n, e) composing public key of RSA cryptosystem.
*)
let encrypt_rsa m (n, e) = []
(** Decryption using RSA cryptosystem.
@param m bitarray hash of encrypted message.
@param pub_key a tuple (n, d) composing private key of RSA cryptosystem.
*)
let decrypt_rsa m (n , d) = []
(********** ElGamal Cipher **********)
(** Generate ElGamal public data. Generates a couple (g, p)
where p is a prime bitarray and g a bitarray having high enough order modulo p.
@param p is a prime bitarray having form 2*q + 1 for prime bitarray q.
*)
let rec public_data_g p = ([], [])
(** Generate ElGamal public data.
@param pub_data a tuple (g, p) of public data for ElGamal cryptosystem.
*)
let generate_keys_g (g, p) = ([], [])
(** ElGamal encryption process.
@param msg message to be encrypted.
@param pub_data a tuple (g, p) of ElGamal public data.
@param kA ElGamal public key.
*)
let encrypt_g msg (g, p) kA = ([], [])
(** ElGamal decryption process.
@param msg a tuple (msgA, msgB) forming an encrypted ElGamal message.
@param a private key
@param pub_data a tuple (g, p) of public data for ElGamal cryptosystem.
*)
let decrypt_g (msgA, msgB) a (g, p) = []