Sha256: f1a959e24119f1f8bf4664ea7fbe4bbed8340b88625058ed022935094a6b6530
Contents?: true
Size: 1.89 KB
Versions: 21
Compression:
Stored size: 1.89 KB
Contents
require 'spec_helper' describe RightSupport::Validation::OpenSSL do GOOD_PEM_PUB_RSA = read_fixture('good_pub_rsa.pem') unless const_defined?('GOOD_PEM_PUB_RSA') GOOD_PEM_PRIV_RSA = read_fixture('good_priv_rsa.pem') unless const_defined?('GOOD_PEM_PRIV_RSA') GOOD_ENCRYPTED_PEM_PRIV_RSA = read_fixture('encrypted_priv_rsa.pem') unless const_defined?('GOOD_ENCRYPTED_PEM_PRIV_RSA') GOOD_SSH_PUB_RSA = read_fixture('good_pub_rsa.ssh') unless const_defined?('GOOD_SSH_PUB_RSA') GOOD_SSH_PUB_DSA = read_fixture('good_pub_dsa.ssh') unless const_defined?('GOOD_SSH_PUB_DSA') GOOD_PEM_PRIV_DSA = read_fixture('good_priv_dsa.pem') unless const_defined?('GOOD_PEM_PRIV_DSA') context :pem_public_key? do it 'recognizes valid keys' do RightSupport::Validation.pem_public_key?(GOOD_PEM_PUB_RSA).should == true end it 'recognizes bad keys' do RightSupport::Validation.pem_public_key?(corrupt(GOOD_PEM_PUB_RSA)).should == false RightSupport::Validation.pem_public_key?(nil).should == false RightSupport::Validation.pem_public_key?('').should == false end end context :pem_private_key? do it 'recognizes valid keys' do RightSupport::Validation.pem_private_key?(GOOD_PEM_PRIV_RSA).should == true RightSupport::Validation.pem_private_key?(GOOD_PEM_PRIV_DSA).should == true end it 'considers encrypted keys to be "bad" (not usable)' do RightSupport::Validation.pem_private_key?(GOOD_ENCRYPTED_PEM_PRIV_RSA).should == false end it 'recognizes bad keys' do RightSupport::Validation.pem_private_key?(corrupt(GOOD_PEM_PRIV_RSA)).should == false RightSupport::Validation.pem_private_key?(corrupt(GOOD_PEM_PRIV_RSA, 16)).should == false RightSupport::Validation.pem_private_key?(nil).should == false RightSupport::Validation.pem_private_key?('').should == false end end end
Version data entries
21 entries across 21 versions & 1 rubygems