lib/keychain/certificate.rb in ruby-keychain-0.2.1 vs lib/keychain/certificate.rb in ruby-keychain-0.3.0
- old
+ new
@@ -16,21 +16,21 @@
end
class Keychain::Certificate < Sec::Base
register_type 'SecCertificate'
- ATTR_MAP = {CF::Base.typecast(Sec::kSecAttrAccessible) => :accessible,
- CF::Base.typecast(Sec::kSecAttrAccessGroup) => :access_group,
+ 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}
+ ATTR_MAP[CF::Base.typecast(Sec::kSecAttrAccessible)] = :accessible if defined?(Sec::kSecAttrAccessible)
ATTR_MAP[CF::Base.typecast(Sec::kSecAttrAccessControl)] = :access_control if defined?(Sec::kSecAttrAccessControl)
INVERSE_ATTR_MAP = ATTR_MAP.invert
define_attributes(ATTR_MAP)
@@ -41,10 +41,10 @@
def public_key
key_ref = FFI::MemoryPointer.new(:pointer)
status = Sec.SecCertificateCopyPublicKey(self, key_ref)
Sec.check_osstatus(status)
- Keychain::Key.new(key_ref.read_pointer)
+ Keychain::Key.new(key_ref.read_pointer).release_on_gc
end
def x509
data_ptr = Sec.SecCertificateCopyData(self)
data = CF::Data.new(data_ptr)