46
46
end
47
47
48
48
it "should return an empty array for #tlsv1" do
49
- subject . sslv2 . should == [ ]
49
+ subject . tlsv1 . should == [ ]
50
50
end
51
51
52
52
it "should return an empty array for #weak_ciphers" do
469
469
end
470
470
end
471
471
472
- context "when OpenSSL is compiled without SSLv2" do
473
- before ( :each ) do
474
- subject . add_cipher ( :SSLv3 , "AES256-SHA" , 256 , :accepted )
475
- subject . add_cipher ( :TLSv1 , "AES256-SHA" , 256 , :accepted )
476
- subject . add_cipher ( :SSLv3 , "AES128-SHA" , 128 , :accepted )
477
- subject . sslv2 = false
472
+ context "when printing the results" do
473
+ context "when OpenSSL is compiled without SSLv2" do
474
+ before ( :each ) do
475
+ subject . add_cipher ( :SSLv3 , "AES256-SHA" , 256 , :accepted )
476
+ subject . add_cipher ( :TLSv1 , "AES256-SHA" , 256 , :accepted )
477
+ subject . add_cipher ( :SSLv3 , "AES128-SHA" , 128 , :accepted )
478
+ subject . openssl_sslv2 = false
479
+ end
480
+ it "should warn the user" do
481
+ subject . to_s . should include "*** WARNING: Your OS hates freedom! Your OpenSSL libs are compiled without SSLv2 support!"
482
+ end
478
483
end
479
- it "should warn the user" do
480
- subject . to_s . should include "*** WARNING: Your OS hates freedom! Your OpenSSL libs are compiled without SSLv2 support!"
484
+
485
+ context "when we have SSL results" do
486
+ before ( :each ) do
487
+ subject . add_cipher ( :SSLv3 , "AES256-SHA" , 256 , :accepted )
488
+ subject . add_cipher ( :TLSv1 , "AES256-SHA" , 256 , :accepted )
489
+ subject . add_cipher ( :SSLv3 , "AES128-SHA" , 128 , :accepted )
490
+ subject . add_cipher ( :SSLv3 , "EXP-RC2-CBC-MD5" , 40 , :accepted )
491
+
492
+ cert = OpenSSL ::X509 ::Certificate . new
493
+ key = OpenSSL ::PKey ::RSA . new 2048
494
+ cert . version = 2 #
495
+ cert . serial = 1
496
+ cert . subject = OpenSSL ::X509 ::Name . parse "/DC=org/DC=ruby-lang/CN=Ruby CA"
497
+ cert . issuer = cert . subject
498
+ cert . public_key = key . public_key
499
+ cert . not_before = Time . now
500
+ cert . not_after = cert . not_before + 2 * 365 * 24 * 60 * 60 # 2
501
+
502
+ subject . cert = cert
503
+ end
504
+
505
+ it "should contain the certificate" do
506
+ subject . to_s . should include "Issuer: DC=org, DC=ruby-lang, CN=Ruby CA"
507
+ subject . to_s . should include "Subject: DC=org, DC=ruby-lang, CN=Ruby CA"
508
+ end
509
+
510
+ it "should have a table with our SSL Cipher Results" do
511
+ subject . to_s . should include "Accepted * SSLv3 40 EXP-RC2-CBC-MD5"
512
+ subject . to_s . should include "Accepted SSLv3 128 AES128-SHA"
513
+ subject . to_s . should include "Accepted SSLv3 256 AES256-SHA"
514
+ subject . to_s . should include "Accepted TLSv1 256 AES256-SHA"
515
+ end
516
+ end
517
+
518
+ it "should return an appropriate message when SSL is not supported" do
519
+ subject . stub ( :supports_ssl? ) . and_return ( false )
520
+ subject . to_s . should == "Server does not appear to support SSL on this port!"
481
521
end
522
+
523
+
482
524
end
483
525
484
526
end
0 commit comments