Class: Idb::DeviceCAInterface

Inherits:
CAInterface show all
Defined in:
lib/lib/device_ca_interface.rb

Instance Method Summary collapse

Methods inherited from CAInterface

#server_cert, #sha1_from_der, #stop_cert_server

Constructor Details

#initialize(device) ⇒ DeviceCAInterface

Returns a new instance of DeviceCAInterface.



6
7
8
9
10
11
12
13
14
# File 'lib/lib/device_ca_interface.rb', line 6

def initialize device
  @device = device
  @device_store_path = "/private/var/Keychains/TrustStore.sqlite3"
  base_path = "#{$tmp_path}/device"
  FileUtils.mkdir_p base_path
  @db_path = "#{base_path}/TrustStore.sqlite3"


end

Instance Method Details

#add_cert(cert_file) ⇒ Object



28
29
30
31
32
# File 'lib/lib/device_ca_interface.rb', line 28

def add_cert cert_file
  FileUtils.copy_file @db_path, "#{@db_path}-#{Time.now.to_s}"
  super cert_file
  @device.ops.upload @db_path, @device_store_path
end

#get_certsObject



17
18
19
20
# File 'lib/lib/device_ca_interface.rb', line 17

def get_certs
  @device.ops.download @device_store_path, @db_path
  super
end

#remove_cert(cert) ⇒ Object



22
23
24
25
26
# File 'lib/lib/device_ca_interface.rb', line 22

def remove_cert cert
  FileUtils.copy_file @db_path, "#{@db_path}-#{Time.now.to_s}"
  super cert
  @device.ops.upload @db_path, @device_store_path
end