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
q
with format and length as specified insuite
type pinhash
=[
|
`String of string
|
`Digest of Cstruct.t
]
if pinhash is
`String x
,gen
andverify
will apply the Pin Hash algorithm specified insuite
to 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
,gen
andverify
will useUnix
.time and the timestep specified insuite
to 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.result
Generate
OCRA(K, {[C] | Q | [P | S | T]})
.- returns
Ok a
the 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.result
val 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.result
Verify OCRA Response.
- returns
Ok (true, None)
upon successful verification forsuite
withoutC
DataInputOk (true, Some next_counter)
upon successful verification forsuite
withC
DataInputOk (false, None)
if verification failedError (DataInput error_message)
if parameters do not matchsuite
Error (Window error_message)
on invalidcw
andtw
parameters
- 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