Class: Keychain::Certificate
Constant Summary
collapse
- ATTR_MAP =
{CF::Base.typecast(Sec::kSecAttrAccessGroup) => :access_group,
CF::Base.typecast(Sec::kSecAttrCertificateType) => :certificate_type,
CF::Base.typecast(Sec::kSecAttrCertificateEncoding) => :certificate_encoding,
CF::Base.typecast(Sec::kSecAttrLabel) => :label,
CF::Base.typecast(Sec::kSecAttrSubject) => :subject,
CF::Base.typecast(Sec::kSecAttrIssuer) => :issuer,
CF::Base.typecast(Sec::kSecAttrSerialNumber) => :serial_number,
CF::Base.typecast(Sec::kSecAttrSubjectKeyID) => :subject_key_id,
CF::Base.typecast(Sec::kSecAttrPublicKeyHash) => :public_key_hash}
- INVERSE_ATTR_MAP =
ATTR_MAP.invert
Instance Attribute Summary
Attributes inherited from Sec::Base
#attributes
Instance Method Summary
collapse
Methods inherited from Sec::Base
define_attributes, #initialize, #keychain, #load_attributes, register_type, #update_self_from_dictionary
Constructor Details
This class inherits a constructor from Sec::Base
Instance Method Details
#public_key ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/keychain/certificate.rb', line 42
def public_key
key_ref = FFI::MemoryPointer.new(:pointer)
status = Sec.SecCertificateCopyPublicKey(self, key_ref)
Sec.check_osstatus(status)
Key.new(key_ref.read_pointer).release_on_gc
end
|
#x509 ⇒ Object
50
51
52
53
54
55
56
57
|
# File 'lib/keychain/certificate.rb', line 50
def x509
data_ptr = Sec.SecCertificateCopyData(self)
data = CF::Data.new(data_ptr)
result = OpenSSL::X509::Certificate.new(data.to_s)
data.release
result
end
|