summaryrefslogtreecommitdiff
path: root/lib/srp/authentication.rb
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2012-10-04 11:23:00 +0200
committerAzul <azul@riseup.net>2012-10-04 11:41:53 +0200
commit0e5f57d3e07db606a779485e1537d4db8b5d3da2 (patch)
tree90733e690fac48da221f3fa7db04aa23ba5423b7 /lib/srp/authentication.rb
parent66c3ed01eb012cae84193b4864c7c48eb77c2a8c (diff)
created session class to hold aa, bb and so forth - done for client
We have a session in the server already - duplication there now, merge next
Diffstat (limited to 'lib/srp/authentication.rb')
-rw-r--r--lib/srp/authentication.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/srp/authentication.rb b/lib/srp/authentication.rb
index 3428fd4..c87fe1d 100644
--- a/lib/srp/authentication.rb
+++ b/lib/srp/authentication.rb
@@ -17,7 +17,7 @@ module SRP
end
def u
- calculate_u(aa, bb)
+ @u ||= calculate_u
end
# do not cache this - it's secret and someone might store the
@@ -28,11 +28,20 @@ module SRP
end
def m1(verifier)
- calculate_m(aa, bb, secret(verifier))
+ calculate_m(secret(verifier))
end
def m2(m1, verifier)
- calculate_m(aa, m1, secret(verifier))
+ sha256_int(@aa, m1, secret(verifier)).hex
+ end
+
+ protected
+ def calculate_u
+ sha256_int(@aa, @bb).hex
+ end
+
+ def calculate_m(s)
+ sha256_int(@aa, @bb, s).hex
end
end