Sha256: b76eeaf476f6d02829fefc53e1435de2443f326799ca882061fbf1a82caecdcf

Contents?: true

Size: 602 Bytes

Versions: 7

Compression:

Stored size: 602 Bytes

Contents

require 'digest/sha1'
require 'base64'
require 'openssl'
require 'signet'
require 'compat/base64'

module Signet #:nodoc:
  module OAuth1
    module RSASHA1
      def self.generate_signature(
          base_string, client_credential_secret, token_credential_secret)

        private_key = OpenSSL::PKey::RSA.new(client_credential_secret)
        signature = private_key.sign(OpenSSL::Digest::SHA1.new, base_string)
        #using strict_encode64 because the encode64 method adds newline characters after ever 60 chars
        return Base64.strict_encode64(signature).strip
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
signet-0.7.3 lib/signet/oauth_1/signature_methods/rsa_sha1.rb
signet-0.7.2 lib/signet/oauth_1/signature_methods/rsa_sha1.rb
signet-0.7.1 lib/signet/oauth_1/signature_methods/rsa_sha1.rb
signet-0.7.0 lib/signet/oauth_1/signature_methods/rsa_sha1.rb
signet-0.6.1 lib/signet/oauth_1/signature_methods/rsa_sha1.rb
signet-0.6.0 lib/signet/oauth_1/signature_methods/rsa_sha1.rb
signet-0.5.1 lib/signet/oauth_1/signature_methods/rsa_sha1.rb