Module Rfc6287
RFC6287 (OCRA)
- see http://tools.ietf.org/html/rfc6287
RFC6287
- see https://www.rfc-editor.org/errata_search.php?eid=3729
Errata 3729
type di={c : bool;C
q : [ `A | `N | `H ] * int;Q
p : [ `SHA1 | `SHA256 | `SHA512 ] option;P
s : int option;S
t : int option;T
}
val challenge : t -> string- returns
random challenge string
qwith format and length as specified insuite
type pinhash=[|`String of string|`Digest of Cstruct.t]if pinhash is
`String x,genandverifywill apply the Pin Hash algorithm specified insuiteto calculate the digest of x.if pinhash is
`Digest d, its length must equal digests size of Pin Hash function (as specified insuite)
type timestamp=[|`Now|`Int64 of int64]if timestamp is
`Now,genandverifywill useUnix.time and the timestep specified insuiteto calculate the timestamp value
val gen : ?time:int64 -> ?c:int64 -> ?p:pinhash -> ?s:Cstruct.t -> ?t:timestamp -> key:Cstruct.t -> q:string -> t -> (Cstruct.t, err) Rresult.resultGenerate
OCRA(K, {[C] | Q | [P | S | T]}).- returns
Ok athe responseError (DataInput error_message)if parameters do not matchsuite
- parameter c
DataInput C: Counter
- parameter p
DataInput P: Pin Hash
- parameter s
DataInput S: Session; length must equal session size (as specified in
suite)
- parameter t
DataInput T: Timestamp
- parameter key
CryptoFunction key K
- parameter q
DataInput Q: Challenge
val gen1 : ?time:int64 -> c:int64 option -> p:pinhash option -> s:Cstruct.t option -> t:timestamp option -> key:Cstruct.t -> q:string -> t -> (Cstruct.t, err) Rresult.resultval verify : ?time:int64 -> ?c:int64 -> ?p:pinhash -> ?s:Cstruct.t -> ?t:timestamp -> ?cw:int -> ?tw:int -> key:Cstruct.t -> q:string -> a:Cstruct.t -> t -> (bool * int64 option, err) Rresult.resultVerify OCRA Response.
- returns
Ok (true, None)upon successful verification forsuitewithoutCDataInputOk (true, Some next_counter)upon successful verification forsuitewithCDataInputOk (false, None)if verification failedError (DataInput error_message)if parameters do not matchsuiteError (Window error_message)on invalidcwandtwparameters
- parameter c
DataInput C: Counter
- parameter p
DataInput P: Pin Hash
- parameter s
DataInput S: Session; length must equal session size (as specified in
suite)
- parameter t
DataInput T: Timestamp
- parameter cw
Counter Window
- parameter tw
Timestamp Window
- parameter key
CryptoFunction key K
- parameter q
DataInput Q: Challenge
- parameter a
Response to check against