Class: Nanite::StaticCertificateStore

Inherits:
Object
  • Object
show all
Defined in:
lib/nanite/security/static_certificate_store.rb

Overview

Simple certificate store, serves a static set of certificates.

Instance Method Summary collapse

Constructor Details

#initialize(signer_certs, recipients_certs) ⇒ StaticCertificateStore

Initialize store:

- Signer certificates are used when loading data to check the digital
  signature. The signature associated with the serialized data needs
  to match with one of the signer certificates for loading to succeed.

- Recipient certificates are used when serializing data for encryption.
  Loading the data can only be done through serializers that have been
  initialized with a certificate that's in the recipient certificates if
  encryption is enabled.


17
18
19
20
21
22
# File 'lib/nanite/security/static_certificate_store.rb', line 17

def initialize(signer_certs, recipients_certs)
  signer_certs = [ signer_certs ] unless signer_certs.respond_to?(:each)
  @signer_certs = signer_certs 
  recipients_certs = [ recipients_certs ] unless recipients_certs.respond_to?(:each)
  @recipients_certs = recipients_certs
end

Instance Method Details

#get_recipients(obj) ⇒ Object

Recipient certificate(s) that will be able to decrypt the serialized data



30
31
32
# File 'lib/nanite/security/static_certificate_store.rb', line 30

def get_recipients(obj)
  @recipients_certs
end

#get_signer(identity) ⇒ Object

Retrieve signer certificate for given id



25
26
27
# File 'lib/nanite/security/static_certificate_store.rb', line 25

def get_signer(identity)
  @signer_certs
end