summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ruby-srp.rb (renamed from lib/srp.rb)2
-rw-r--r--lib/srp/authentication.rb4
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/srp.rb b/lib/ruby-srp.rb
index a008b82..7cbe06f 100644
--- a/lib/srp.rb
+++ b/lib/ruby-srp.rb
@@ -10,4 +10,6 @@ $:.unshift File.dirname(__FILE__)
module SRP
autoload :Client, 'srp/client'
autoload :Authentication, 'srp/authentication'
+ class WrongPassword < StandardError
+ end
end
diff --git a/lib/srp/authentication.rb b/lib/srp/authentication.rb
index a2431d0..4afe20b 100644
--- a/lib/srp/authentication.rb
+++ b/lib/srp/authentication.rb
@@ -41,6 +41,10 @@ module SRP
return Session.new(aa, verifier)
end
+ def authenticate!(m, session)
+ authenticate(m, session) || raise(SRP::WrongPassword)
+ end
+
def authenticate(m, session)
if(m == session.m1(verifier))
return session.m2(m, verifier)