From 8e2215ee6306b0f4c13553796d401e9f5f93bcb6 Mon Sep 17 00:00:00 2001 From: "Damien F. Katz" Date: Tue, 4 Aug 2009 19:50:46 +0000 Subject: Initial check-in of OAuth and cookie authentication. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@800938 13f79535-47bb-0310-9956-ffa450edef68 --- src/erlang-oauth/oauth_hmac_sha1.erl | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/erlang-oauth/oauth_hmac_sha1.erl (limited to 'src/erlang-oauth/oauth_hmac_sha1.erl') diff --git a/src/erlang-oauth/oauth_hmac_sha1.erl b/src/erlang-oauth/oauth_hmac_sha1.erl new file mode 100644 index 00000000..69064edd --- /dev/null +++ b/src/erlang-oauth/oauth_hmac_sha1.erl @@ -0,0 +1,11 @@ +-module(oauth_hmac_sha1). + +-export([signature/3, verify/4]). + + +signature(BaseString, CS, TS) -> + Key = oauth_uri:calate("&", [CS, TS]), + base64:encode_to_string(crypto:sha_mac(Key, BaseString)). + +verify(Signature, BaseString, CS, TS) -> + Signature =:= signature(BaseString, CS, TS). -- cgit v1.2.3