Sha256: 1d39424a583fef405d88642ff6301efa1327e02ec1079b9b071ffd297503ec13
Contents?: true
Size: 948 Bytes
Versions: 5
Compression:
Stored size: 948 Bytes
Contents
# frozen_string_literal: true require 'mechanize/test_case' class TestMechanizeFormKeygen < Mechanize::TestCase def setup super keygen = node('keygen', 'name' => 'userkey', 'challenge' => 'f4832e1d200df3df8c5c859edcabe52f') @keygen = Mechanize::Form::Keygen.new keygen end def test_challenge assert_equal "f4832e1d200df3df8c5c859edcabe52f", @keygen.challenge end def test_key assert @keygen.key.kind_of?(OpenSSL::PKey::PKey), "Not an OpenSSL key" assert @keygen.key.private?, "Not a private key" end def test_spki_signature skip("JRuby PKI doesn't handle this for reasons I've been unable to understand") if RUBY_ENGINE=~/jruby/ spki = OpenSSL::Netscape::SPKI.new @keygen.value assert_equal @keygen.challenge, spki.challenge assert_equal @keygen.key.public_key.to_pem, spki.public_key.to_pem assert spki.verify(@keygen.key.public_key) end end
Version data entries
5 entries across 5 versions & 1 rubygems