1 //! Additional SRP types.
2 use num_bigint::BigUint;
5 /// SRP authentication error.
6 #[derive(Debug, Clone, Eq, PartialEq)]
7 pub enum SrpAuthError {
8 IllegalParameter(String),
12 impl fmt::Display for SrpAuthError {
13 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
15 SrpAuthError::IllegalParameter(param) => {
16 write!(f, "illegal_parameter: bad '{}' value", param)
18 SrpAuthError::BadRecordMac(param) => {
19 write!(f, "bad_record_mac: incorrect '{}' proof", param)
25 /// Group used for SRP computations
26 #[derive(Debug, Clone, Eq, PartialEq)]
28 /// A large safe prime (N = 2q+1, where q is prime)
30 /// A generator modulo N
36 use crate::groups::G_1024;
37 use crate::utils::compute_k;
41 fn test_k_1024_sha1() {
42 let k = compute_k::<Sha1>(&G_1024).to_bytes_be();
43 assert_eq!(&k, include_bytes!("test/k_sha1_1024.bin"));