Cryptokit

`sig
class type transform =
object
method available_output : int
method finish : unit
method flush : unit
method get_byte : int
method get_char : char
method get_string : string
method get_substring : string * int * int
method input_block_size : int
method output_block_size : int
method put_byte : int -> unit
method put_char : char -> unit
method put_string : string -> unit
method put_substring : string -> int -> int -> unit
method wipe : unit
end
val transform_string : Cryptokit.transform -> string -> string
val transform_channel :
Cryptokit.transform ->
?len:int -> Pervasives.in_channel -> Pervasives.out_channel -> unit
val compose :
Cryptokit.transform -> Cryptokit.transform -> Cryptokit.transform
class type hash =
object
method add_byte : int -> unit
method add_char : char -> unit
method add_string : string -> unit
method add_substring : string -> int -> int -> unit
method hash_size : int
method result : string
method wipe : unit
end
val hash_string : Cryptokit.hash -> string -> string
val hash_channel :
Cryptokit.hash -> ?len:int -> Pervasives.in_channel -> string
module Random :
sig
class type rng =
object
method random_bytes : string -> int -> int -> unit
method wipe : unit
end
val string : Cryptokit.Random.rng -> int -> string
val secure_rng : Cryptokit.Random.rng
val system_rng : unit -> Cryptokit.Random.rng
val device_rng : string -> Cryptokit.Random.rng
val egd_rng : string -> Cryptokit.Random.rng
val pseudo_rng : string -> Cryptokit.Random.rng
end
module Padding :
sig
class type scheme =
object
method pad : string -> int -> unit
method strip : string -> int
end
val length : Cryptokit.Padding.scheme
val _8000 : Cryptokit.Padding.scheme
end
module Cipher :
sig
type direction = Encrypt | Decrypt
type chaining_mode = ECB | CBC | CFB of int | OFB of int
val aes :
?mode:Cryptokit.Cipher.chaining_mode ->
?pad:Cryptokit.Padding.scheme ->
?iv:string ->
string -> Cryptokit.Cipher.direction -> Cryptokit.transform
val des :
?mode:Cryptokit.Cipher.chaining_mode ->
?pad:Cryptokit.Padding.scheme ->
?iv:string ->
string -> Cryptokit.Cipher.direction -> Cryptokit.transform
val triple_des :
?mode:Cryptokit.Cipher.chaining_mode ->
?pad:Cryptokit.Padding.scheme ->
?iv:string ->
string -> Cryptokit.Cipher.direction -> Cryptokit.transform
val arcfour :
string -> Cryptokit.Cipher.direction -> Cryptokit.transform
end
module Hash :
sig
val sha1 : unit -> Cryptokit.hash
val sha256 : unit -> Cryptokit.hash
val ripemd160 : unit -> Cryptokit.hash
val md5 : unit -> Cryptokit.hash
end
module MAC :
sig
val hmac_sha1 : string -> Cryptokit.hash
val hmac_md5 : string -> Cryptokit.hash
val aes :
?iv:string ->
?pad:Cryptokit.Padding.scheme -> string -> Cryptokit.hash
val des :
?iv:string ->
?pad:Cryptokit.Padding.scheme -> string -> Cryptokit.hash
val triple_des :
?iv:string ->
?pad:Cryptokit.Padding.scheme -> string -> Cryptokit.hash
val des_final_triple_des :
?iv:string ->
?pad:Cryptokit.Padding.scheme -> string -> Cryptokit.hash
end
module RSA :
sig
type key = {
size : int;
n : string;
e : string;
d : string;
p : string;
q : string;
dp : string;
dq : string;
qinv : string;
}
val wipe_key : Cryptokit.RSA.key -> unit
val new_key :
?rng:Cryptokit.Random.rng -> ?e:int -> int -> Cryptokit.RSA.key
val encrypt : Cryptokit.RSA.key -> string -> string
val decrypt : Cryptokit.RSA.key -> string -> string
val decrypt_CRT : Cryptokit.RSA.key -> string -> string
val sign : Cryptokit.RSA.key -> string -> string
val sign_CRT : Cryptokit.RSA.key -> string -> string
val unwrap_signature : Cryptokit.RSA.key -> string -> string
end
module DH :
sig
type parameters = { p : string; g : string; privlen : int; }
val new_parameters :
?rng:Cryptokit.Random.rng ->
?privlen:int -> int -> Cryptokit.DH.parameters
type private_secret
val private_secret :
?rng:Cryptokit.Random.rng ->
Cryptokit.DH.parameters -> Cryptokit.DH.private_secret
val message :
Cryptokit.DH.parameters -> Cryptokit.DH.private_secret -> string
val shared_secret :
Cryptokit.DH.parameters ->
Cryptokit.DH.private_secret -> string -> string
val derive_key : ?diversification:string -> string -> int -> string
end
module Block :
sig
class type block_cipher =
object
method blocksize : int
method transform : string -> int -> string -> int -> unit
method wipe : unit
end
class cipher : Cryptokit.Block.block_cipher -> transform
class cipher_padded_encrypt :
Cryptokit.Padding.scheme -> Cryptokit.Block.block_cipher -> transform
class cipher_padded_decrypt :
Cryptokit.Padding.scheme -> Cryptokit.Block.block_cipher -> transform
class mac :
?iv:string ->
?pad:Cryptokit.Padding.scheme -> Cryptokit.Block.block_cipher -> hash
class mac_final_triple :
?iv:string ->
?pad:Cryptokit.Padding.scheme ->
Cryptokit.Block.block_cipher ->
Cryptokit.Block.block_cipher -> Cryptokit.Block.block_cipher -> hash
class aes_encrypt : string -> block_cipher
class aes_decrypt : string -> block_cipher
class des_encrypt : string -> block_cipher
class des_decrypt : string -> block_cipher
class triple_des_encrypt : string -> block_cipher
class triple_des_decrypt : string -> block_cipher
class cbc_encrypt :
?iv:string -> Cryptokit.Block.block_cipher -> block_cipher
class cbc_decrypt :
?iv:string -> Cryptokit.Block.block_cipher -> block_cipher
class cfb_encrypt :
?iv:string -> int -> Cryptokit.Block.block_cipher -> block_cipher
class cfb_decrypt :
?iv:string -> int -> Cryptokit.Block.block_cipher -> block_cipher
class ofb :
?iv:string -> int -> Cryptokit.Block.block_cipher -> block_cipher
end
module Stream :
sig
class type stream_cipher =
object
method transform : string -> int -> string -> int -> int -> unit
method wipe : unit
end
class cipher : Cryptokit.Stream.stream_cipher -> transform
class arcfour : string -> stream_cipher
end
module Base64 :
sig
val encode_multiline : unit -> Cryptokit.transform
val encode_compact : unit -> Cryptokit.transform
val decode : unit -> Cryptokit.transform
end
module Hexa :
sig
val encode : unit -> Cryptokit.transform
val decode : unit -> Cryptokit.transform
end
module Zlib :
sig
val compress : ?level:int -> unit -> Cryptokit.transform
val uncompress : unit -> Cryptokit.transform
end
type error =
Wrong_key_size
| Wrong_IV_size
| Wrong_data_length
| Bad_padding
| Output_buffer_overflow
| Incompatible_block_size
| Number_too_long
| Seed_too_short
| Message_too_long
| Bad_encoding
| Compression_error of string * string
| No_entropy_source
| Entropy_source_closed
| Compression_not_supported
exception Error of Cryptokit.error
val wipe_string : string -> unit
val xor_string : string -> int -> string -> int -> int -> unit
val mod_power : string -> string -> string -> string
val mod_mult : string -> string -> string -> string
end`