Function oath::ocra_debug
[−]
[src]
pub fn ocra_debug(
suite: &str,
key: &[u8],
counter: u64,
question: &str,
password: &[u8],
session_info: &[u8],
num_of_time_steps: u64
) -> Result<u64, String>
ocra_debug
is an OCRA implementation with
detailed errors descriptions. Use it for debugging purpose only!
For production code use ocra
function.
suite
is a value representing the suite of operations to compute an OCRA response;
key
is a secret, previously shared between client and server;
counter
optional synchronized between the client and the server u64 counter;
question
mandatory challenge question(s) generated by the parties;
password
optional ALREADY HASHED value of PIN/password that is known to all parties
during the execution of the algorithm;
session_info
optional information about the current session;
num_of_time_steps
optional number of time steps since midnight UTC of January 1, 1970;
step size is predefined in the suite;
Example
extern crate oath; use oath::ocra; fn main () { let suite_c = "OCRA-1:HOTP-SHA256-8:C-QN08-PSHA1"; let STANDARD_KEY_32 = b"12345678901234567890123456789012"; let PIN_1234_SHA1 = &[0x71, 0x10, 0xed, 0xa4, 0xd0, 0x9e, 0x06, 0x2a, 0xa5, 0xe4, 0xa3, 0x90, 0xb0, 0xa5, 0x72, 0xac, 0x0d, 0x2c, 0x02, 0x20]; assert_eq!(ocra(&suite_c, STANDARD_KEY_32, 6, "12345678", PIN_1234_SHA1, &[], 0), Ok(70069104)); }