diff options
author | Adam Kocoloski <adam@cloudant.com> | 2010-10-26 13:47:23 -0400 |
---|---|---|
committer | Adam Kocoloski <adam@cloudant.com> | 2010-10-26 13:47:23 -0400 |
commit | af10842462fcd6e878717058c87f99667c8d516c (patch) | |
tree | 545d1beda3438e02a853c3b17e1a6dd9c9078fc7 /apps/oauth/src/oauth_rsa_sha1.erl | |
parent | 67865c8a5a400e039d41d6cb2759adb43a78e350 (diff) |
use get-deps for oauth
same deal as before - the Cloudant fork contains CouchDB-specific patches
and rebar fixes.
Diffstat (limited to 'apps/oauth/src/oauth_rsa_sha1.erl')
-rw-r--r-- | apps/oauth/src/oauth_rsa_sha1.erl | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/apps/oauth/src/oauth_rsa_sha1.erl b/apps/oauth/src/oauth_rsa_sha1.erl deleted file mode 100644 index 6f4828e0..00000000 --- a/apps/oauth/src/oauth_rsa_sha1.erl +++ /dev/null @@ -1,30 +0,0 @@ --module(oauth_rsa_sha1). - --export([signature/2, verify/3]). - --include_lib("public_key/include/public_key.hrl"). - - -signature(BaseString, PrivateKeyPath) -> - {ok, [Info]} = public_key:pem_to_der(PrivateKeyPath), - {ok, PrivateKey} = public_key:decode_private_key(Info), - base64:encode_to_string(public_key:sign(list_to_binary(BaseString), PrivateKey)). - -verify(Signature, BaseString, PublicKey) -> - public_key:verify_signature(to_binary(BaseString), sha, base64:decode(Signature), public_key(PublicKey)). - -to_binary(Term) when is_list(Term) -> - list_to_binary(Term); -to_binary(Term) when is_binary(Term) -> - Term. - -public_key(Path) when is_list(Path) -> - {ok, [{cert, DerCert, not_encrypted}]} = public_key:pem_to_der(Path), - {ok, Cert} = public_key:pkix_decode_cert(DerCert, otp), - public_key(Cert); -public_key(#'OTPCertificate'{tbsCertificate=Cert}) -> - public_key(Cert); -public_key(#'OTPTBSCertificate'{subjectPublicKeyInfo=Info}) -> - public_key(Info); -public_key(#'OTPSubjectPublicKeyInfo'{subjectPublicKey=Key}) -> - Key. |