Class: Liberic::Certificate
- Inherits:
-
Object
- Object
- Liberic::Certificate
- Defined in:
- lib/liberic/certificate.rb
Overview
Certificate
encapsulates functionality regarding certificates (for signing). An instance of Certificate is passed on to EricBearbeiteVorgang() where necessary.
Instance Attribute Summary collapse
-
#features ⇒ Object
readonly
Returns the value of attribute features.
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
Instance Method Summary collapse
-
#encryption_params ⇒ Object
Returns a
SDK::Types::VerschluesselungsParameter
data structure that can be passed on to Process.execute. -
#initialize(cert_file, pin) ⇒ Certificate
constructor
cert_file
path to a pfx file (Portal-Zertifikat)pin
the pin for the certificate (if applicable, string). -
#properties ⇒ Object
Returns the result of EricHoleZertifikatEigenschaften() This will be XML describing fields and properties associated with the certificate.
- #release_handle! ⇒ Object
Constructor Details
#initialize(cert_file, pin) ⇒ Certificate
cert_file
path to a pfx file (Portal-Zertifikat) pin
the pin for the certificate (if applicable, string)
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/liberic/certificate.rb', line 9 def initialize(cert_file, pin) @pin = pin ch = FFI::MemoryPointer.new(:uint32, 1) cert_feature_flag_pointer = FFI::MemoryPointer.new(:uint32, 1) Liberic::Helpers::Invocation.raise_on_error( Liberic::SDK::API.get_handle_to_certificate(ch, cert_feature_flag_pointer, cert_file) ) @handle = ch.get_uint32(0) flags = cert_feature_flag_pointer.get_uint32(0) @features = PinFeatures.new( (flags & 0x00) != 0, (flags & 0x01) != 0, (flags & 0x02) != 0, (flags & 0x04) != 0, (flags & 0x10) != 0, (flags & 0x20) != 0, (flags & 0x40) != 0, (flags & 0x80) != 0 ) end |
Instance Attribute Details
#features ⇒ Object (readonly)
Returns the value of attribute features.
5 6 7 |
# File 'lib/liberic/certificate.rb', line 5 def features @features end |
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
5 6 7 |
# File 'lib/liberic/certificate.rb', line 5 def handle @handle end |
Instance Method Details
#encryption_params ⇒ Object
Returns a SDK::Types::VerschluesselungsParameter
data structure that can be passed on to Process.execute
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/liberic/certificate.rb', line 43 def encryption_params params = SDK::Types::VerschluesselungsParameter.new params[:version] = 2 params[:zertifikatHandle] = @handle params[:pin] = FFI::MemoryPointer.from_string(@pin).address params[:abrufCode] = nil params end |
#properties ⇒ Object
Returns the result of EricHoleZertifikatEigenschaften() This will be XML describing fields and properties associated with the certificate.
35 36 37 38 39 |
# File 'lib/liberic/certificate.rb', line 35 def properties Helpers::Invocation.with_result_buffer do |buffer_handle| SDK::API.hole_zertifikat_eigenschaften(@handle, @pin, buffer_handle) end end |