Permalink
Browse files

Addition of a new hex_serial method.

  • Loading branch information...
1 parent dadd220 commit 1821c4aa3701bf1775b58f95013a91e713b83209 @pyrat pyrat committed Sep 15, 2011
@@ -52,7 +52,6 @@ def issuing_certificate?(issuer)
def read_extension_by_oid(oid)
(extensions.detect { |e| e.to_a.first == oid } || []).to_a[1]
end
- protected :read_extension_by_oid
##
# Returns +true+ if this certificate is a root certificate (it is its
@@ -100,6 +99,14 @@ def ssl_version
$1.to_i
end
end
+
+ ##
+ # OpenSSL deals with serials in HEX format.
+ # This gives you the ability to get this hex serial if you need to work with
+ # certificate information directly.
+ def hex_serial
+ serial.to_s(16).upcase
+ end
end
@@ -106,4 +106,14 @@
extended_ssl_certificates('globalsign-root-ca').should be_root
end
end
+
+ context 'hexserial' do
+
+ subject { ssl_certificates('GeoTrust Extended Validation SSL CA').extend(OpenSSLExtensions::X509::Certificate) }
+
+ its(:hex_serial) { should == '6948A26B201AA421E898B1C492C7C58E' }
+
+ end
+
+
end

0 comments on commit 1821c4a

Please sign in to comment.