sig
exception Insufficient_key
type pub = { e : Z.t; n : Z.t; }
type priv = {
e : Z.t;
d : Z.t;
n : Z.t;
p : Z.t;
q : Z.t;
dp : Z.t;
dq : Z.t;
q' : Z.t;
}
type mask = [ `No | `Yes | `Yes_with of Nocrypto.Rng.g ]
val pub_bits : Nocrypto.Rsa.pub -> int
val priv_bits : Nocrypto.Rsa.priv -> int
val priv_of_primes : e:Z.t -> p:Z.t -> q:Z.t -> Nocrypto.Rsa.priv
val pub_of_priv : Nocrypto.Rsa.priv -> Nocrypto.Rsa.pub
val encrypt : key:Nocrypto.Rsa.pub -> Cstruct.t -> Cstruct.t
val decrypt :
?mask:Nocrypto.Rsa.mask ->
key:Nocrypto.Rsa.priv -> Cstruct.t -> Cstruct.t
val generate : ?g:Nocrypto.Rng.g -> ?e:Z.t -> int -> Nocrypto.Rsa.priv
module PKCS1 :
sig
val sig_encode :
?mask:Nocrypto.Rsa.mask ->
key:Nocrypto.Rsa.priv -> Cstruct.t -> Cstruct.t
val sig_decode : key:Nocrypto.Rsa.pub -> Cstruct.t -> Cstruct.t option
val encrypt :
?g:Nocrypto.Rng.g -> key:Nocrypto.Rsa.pub -> Cstruct.t -> Cstruct.t
val decrypt :
?mask:Nocrypto.Rsa.mask ->
key:Nocrypto.Rsa.priv -> Cstruct.t -> Cstruct.t option
end
module OAEP :
functor (H : Hash.S) ->
sig
val encrypt :
?g:Nocrypto.Rng.g ->
?label:Cstruct.t -> key:Nocrypto.Rsa.pub -> Cstruct.t -> Cstruct.t
val decrypt :
?mask:Nocrypto.Rsa.mask ->
?label:Cstruct.t ->
key:Nocrypto.Rsa.priv -> Cstruct.t -> Cstruct.t option
end
module PSS :
functor (H : Hash.S) ->
sig
val sign :
?g:Nocrypto.Rng.g ->
?slen:int -> key:Nocrypto.Rsa.priv -> Cstruct.t -> Cstruct.t
val verify :
?slen:int ->
key:Nocrypto.Rsa.pub -> signature:Cstruct.t -> Cstruct.t -> bool
end
val pub_of_sexp : Sexplib.Sexp.t -> Nocrypto.Rsa.pub
val sexp_of_pub : Nocrypto.Rsa.pub -> Sexplib.Sexp.t
val priv_of_sexp : Sexplib.Sexp.t -> Nocrypto.Rsa.priv
val sexp_of_priv : Nocrypto.Rsa.priv -> Sexplib.Sexp.t
end