Ruby script - unable to load "ecdsa" file

I am new to Ruby and have a .rb script to run. I’ve downloaded
“Ruby200” and when I try to run the script I get some errors as below.
What does it mean? It says ecdsa (Load Error), is this a file that user
needs to supply? Our team doesn’t own it but we got a request to run
this script, so i’m investigating. Please help m.e

C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
require ': cannot load such file -- ecdsa (LoadError) from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:5 5:inrequire’
from xasstest.rb:9:in `’

Look at line 9 in xasstest.rb

Joel P. wrote in post #1143510:

Look at line 9 in xasstest.rb

require ‘securerandom’ is the line number 9. Currently, I open the
script in notepad++. Is there any other editor that I can use it to open
from ruby\bin folder?

require ‘rubygems’
require ‘ecdsa’
require ‘securerandom’
require ‘json’
require ‘base64’
require ‘digest’
require ‘rest-client’

Priy Nag wrote in post #1143512:

Joel P. wrote in post #1143510:

Look at line 9 in xasstest.rb

require ‘securerandom’ is the line number 9. Currently, I open the
script in notepad++. Is there any other editor that I can use it to open
from ruby\bin folder?

require ‘rubygems’
require ‘ecdsa’
require ‘securerandom’
require ‘json’
require ‘base64’
require ‘digest’
require ‘rest-client’

I needed to install gem ecdsa and rest-client. Now there is no error.

C:\Ruby193\bin>ruby.exe xasstest.rb
Usage: xasstest.rb

C:\Ruby193\bin>

Notepad++ is my preferred editor for Ruby on Windows. You might want to
try Aptana Studio 3 (RadRails) if you use Rails.

Joel P. wrote in post #1143521:

Notepad++ is my preferred editor for Ruby on Windows. You might want to
try Aptana Studio 3 (RadRails) if you use Rails.

Can someone help me to fix this issue? It fails in
client_cert = OpenSSL::PKCS12.new File.read(pfx_file), pfx_pass

xasstest.rb:86:in `initialize’: PKCS12_parse: mac verify failure
(OpenSSL::PKCS12::PKCS12Error)

    from xasstest.rb:86:in `new'
    from xasstest.rb:86:in `Test
    from xasstest.rb:130:in `<main>'

Here is the function where the test fails:

def Test(xass_body, xass_headers, pfxFile, pfxPassword)
xass_url = ‘https://service.auth.xboxlive.com/service/authenticate
puts “Xass_url is: ‘#{xass_url}’”
client_cert = OpenSSL::PKCS12.new File.read(pfxFile), pfxPassword

rc = RestClient::Resource.new(
xass_url,
:ssl_client_cert => client_cert.certificate,
:ssl_client_key => client_cert.key,
:verify_ssl => OpenSSL::SSL::VERIFY_PEER
)

rc.post(xass_body, xass_headers)
end

Priy Nag wrote in post #1143809:

Joel P. wrote in post #1143521:

Notepad++ is my preferred editor for Ruby on Windows. You might want to
try Aptana Studio 3 (RadRails) if you use Rails.

Can someone help me to fix this issue? It fails in
client_cert = OpenSSL::PKCS12.new File.read(pfx_file), pfx_pass

xasstest.rb:86:in `initialize’: PKCS12_parse: mac verify failure
(OpenSSL::PKCS12::PKCS12Error)

    from xasstest.rb:86:in `new'
    from xasstest.rb:86:in `Test
    from xasstest.rb:130:in `<main>'

Here is the function where the test fails:

def Test(xass_body, xass_headers, pfxFile, pfxPassword)
xass_url = ‘https://service.auth.xboxlive.com/service/authenticate
puts “Xass_url is: ‘#{xass_url}’”
client_cert = OpenSSL::PKCS12.new File.read(pfxFile), pfxPassword

rc = RestClient::Resource.new(
xass_url,
:ssl_client_cert => client_cert.certificate,
:ssl_client_key => client_cert.key,
:verify_ssl => OpenSSL::SSL::VERIFY_PEER
)

rc.post(xass_body, xass_headers)
end

Guys,

This is the issue(below url) that I face right now, When I try to update
the below line with “rb” then I get an error cannot convert from string
to integer error. I’m running this script in Windows(ruby 1.9.3). It
would be great if someone help me on this.

client_cert = OpenSSL::PKCS12.new File.read(pfx_file), “rb”),
pfx_pass)

http://stackoverflow.com/questions/10202254/why-openssl-on-windows-produces-error-but-not-on-centos-pkcs12-parse-mac-verif

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs