Class: Ccrypto::X509CertInfo
- Inherits:
-
Object
- Object
- Ccrypto::X509CertInfo
- Includes:
- Java::DataConversion, TR::CondUtils
- Defined in:
- lib/ccrypto/java/ext/x509_cert.rb
Overview
X509NameInfo
Instance Attribute Summary collapse
-
#crl_dist_point ⇒ Object
readonly
Returns the value of attribute crl_dist_point.
-
#dns_name ⇒ Object
readonly
extension.
-
#ip_addr ⇒ Object
readonly
extension.
-
#issuer ⇒ Object
readonly
X509NameInfo structure.
-
#issuer_url ⇒ Object
readonly
Returns the value of attribute issuer_url.
-
#not_after ⇒ Object
readonly
Returns the value of attribute not_after.
-
#not_before ⇒ Object
readonly
Returns the value of attribute not_before.
-
#ocsp_url ⇒ Object
readonly
Returns the value of attribute ocsp_url.
-
#owner ⇒ Object
readonly
X509NameInfo structure.
-
#serial ⇒ Object
readonly
Returns the value of attribute serial.
-
#uri ⇒ Object
readonly
extension.
Instance Method Summary collapse
- #domain_extension(ext) ⇒ Object
- #has_crl_dist_point?(uri = nil) ⇒ Boolean
- #has_dns?(dns = nil) ⇒ Boolean
- #has_domain_extension?(ext) ⇒ Boolean
- #has_domain_key_usage?(usage = nil) ⇒ Boolean
-
#has_ext_key_usage?(const) ⇒ Boolean
const taken from Ccrypto::X509::CertProfile::ExtKeyUsage::Usages.
- #has_ip_addr?(ip = nil) ⇒ Boolean
- #has_issuer_url?(url = nil) ⇒ Boolean
-
#has_key_usage?(const) ⇒ Boolean
const taken from Ccrypto::X509::CertProfile::KeyUsage::Usages.
- #has_ocsp_url?(url = nil) ⇒ Boolean
- #has_uri?(uri = nil) ⇒ Boolean
-
#initialize(cert) ⇒ X509CertInfo
constructor
A new instance of X509CertInfo.
- #is_CA? ⇒ Boolean
- #serial_no(outForm = :hex) ⇒ Object
Methods included from Java::DataConversion
#from_b64, #from_b64_mime, #from_hex, included, #logger, #to_b64, #to_b64_mime, #to_bin, #to_hex, #to_java_bytes, #to_str
Constructor Details
#initialize(cert) ⇒ X509CertInfo
Returns a new instance of X509CertInfo.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 93 def initialize(cert) raise X509CertException, "Given certificate to extract cannot be nil" if cert.nil? @cert = cert @ku = [] @eku = [] @dns_name = [] @ip_addr = [] @uri = [] @crl_dist_point = [] @ocsp_url = [] @issuer_url = [] @domain_key_usage = [] @all_cert_exts = [] extract end |
Instance Attribute Details
#crl_dist_point ⇒ Object (readonly)
Returns the value of attribute crl_dist_point.
91 92 93 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 91 def crl_dist_point @crl_dist_point end |
#dns_name ⇒ Object (readonly)
extension
90 91 92 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 90 def dns_name @dns_name end |
#ip_addr ⇒ Object (readonly)
extension
90 91 92 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 90 def ip_addr @ip_addr end |
#issuer ⇒ Object (readonly)
X509NameInfo structure
86 87 88 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 86 def issuer @issuer end |
#issuer_url ⇒ Object (readonly)
Returns the value of attribute issuer_url.
91 92 93 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 91 def issuer_url @issuer_url end |
#not_after ⇒ Object (readonly)
Returns the value of attribute not_after.
88 89 90 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 88 def not_after @not_after end |
#not_before ⇒ Object (readonly)
Returns the value of attribute not_before.
88 89 90 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 88 def not_before @not_before end |
#ocsp_url ⇒ Object (readonly)
Returns the value of attribute ocsp_url.
91 92 93 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 91 def ocsp_url @ocsp_url end |
#owner ⇒ Object (readonly)
X509NameInfo structure
85 86 87 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 85 def owner @owner end |
#serial ⇒ Object (readonly)
Returns the value of attribute serial.
87 88 89 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 87 def serial @serial end |
#uri ⇒ Object (readonly)
extension
90 91 92 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 90 def uri @uri end |
Instance Method Details
#domain_extension(ext) ⇒ Object
206 207 208 209 210 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 206 def domain_extension(ext) co = org.bouncycastle.cert.jcajce.JcaX509CertificateHolder.new(@cert) extVal = co.getExtension(org.bouncycastle.asn1.ASN1ObjectIdentifier.new(ext)) extVal.getExtnValue.octets end |
#has_crl_dist_point?(uri = nil) ⇒ Boolean
170 171 172 173 174 175 176 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 170 def has_crl_dist_point?(uri = nil) if uri.nil? @crl_dist_point.length > 0 else @crl_dist_point.include?(uri) end end |
#has_dns?(dns = nil) ⇒ Boolean
146 147 148 149 150 151 152 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 146 def has_dns?(dns = nil) if dns.nil? @dns_name.length > 0 else @dns_name.include?(dns) end end |
#has_domain_extension?(ext) ⇒ Boolean
202 203 204 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 202 def has_domain_extension?(ext) @all_cert_exts.include?(ext) end |
#has_domain_key_usage?(usage = nil) ⇒ Boolean
194 195 196 197 198 199 200 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 194 def has_domain_key_usage?(usage = nil) if usage.nil? @domain_key_usage.length > 0 else @domain_key_usage.include?(usage) end end |
#has_ext_key_usage?(const) ⇒ Boolean
const taken from Ccrypto::X509::CertProfile::ExtKeyUsage::Usages
138 139 140 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 138 def has_ext_key_usage?(const) @eku.include?(const) end |
#has_ip_addr?(ip = nil) ⇒ Boolean
154 155 156 157 158 159 160 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 154 def has_ip_addr?(ip = nil) if ip.nil? @ip_addr.length > 0 else @ip_addr.include?(ip) end end |
#has_issuer_url?(url = nil) ⇒ Boolean
186 187 188 189 190 191 192 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 186 def has_issuer_url?(url = nil) if url.nil? @issuer_url.length > 0 else @issuer_url.include?(url) end end |
#has_key_usage?(const) ⇒ Boolean
const taken from Ccrypto::X509::CertProfile::KeyUsage::Usages
131 132 133 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 131 def has_key_usage?(const) @ku.include?(const) end |
#has_ocsp_url?(url = nil) ⇒ Boolean
178 179 180 181 182 183 184 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 178 def has_ocsp_url?(url = nil) if url.nil? @ocsp_url.length > 0 else @ocsp_url.include?(url) end end |
#has_uri?(uri = nil) ⇒ Boolean
162 163 164 165 166 167 168 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 162 def has_uri?(uri = nil) if uri.nil? @uri.length > 0 else @uri.include?(uri) end end |
#is_CA? ⇒ Boolean
142 143 144 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 142 def is_CA? @isCa end |
#serial_no(outForm = :hex) ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/ccrypto/java/ext/x509_cert.rb', line 112 def serial_no(outForm = :hex) if not_empty?(@serial) case outForm when :b64, :base64 to_b64(@serial.to_s) when :hex @serial.to_s(16) else @serial end else raise X509CertException, "Serial not yet loaded" end end |