Module: PolyPseudo::PseudoId
Instance Attribute Summary collapse
-
#creator ⇒ Object
readonly
Returns the value of attribute creator.
-
#point_1 ⇒ Object
readonly
Returns the value of attribute point_1.
-
#point_2 ⇒ Object
readonly
Returns the value of attribute point_2.
-
#point_3 ⇒ Object
readonly
Returns the value of attribute point_3.
-
#recipient ⇒ Object
readonly
Returns the value of attribute recipient.
-
#recipient_key_set_version ⇒ Object
readonly
Returns the value of attribute recipient_key_set_version.
-
#schema_key_version ⇒ Object
readonly
Returns the value of attribute schema_key_version.
-
#schema_version ⇒ Object
readonly
Returns the value of attribute schema_version.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#creator ⇒ Object (readonly)
Returns the value of attribute creator.
29 30 31 |
# File 'lib/poly_pseudo/pseudo_id.rb', line 29 def creator @creator end |
#point_1 ⇒ Object (readonly)
Returns the value of attribute point_1.
29 30 31 |
# File 'lib/poly_pseudo/pseudo_id.rb', line 29 def point_1 @point_1 end |
#point_2 ⇒ Object (readonly)
Returns the value of attribute point_2.
29 30 31 |
# File 'lib/poly_pseudo/pseudo_id.rb', line 29 def point_2 @point_2 end |
#point_3 ⇒ Object (readonly)
Returns the value of attribute point_3.
29 30 31 |
# File 'lib/poly_pseudo/pseudo_id.rb', line 29 def point_3 @point_3 end |
#recipient ⇒ Object (readonly)
Returns the value of attribute recipient.
29 30 31 |
# File 'lib/poly_pseudo/pseudo_id.rb', line 29 def recipient @recipient end |
#recipient_key_set_version ⇒ Object (readonly)
Returns the value of attribute recipient_key_set_version.
29 30 31 |
# File 'lib/poly_pseudo/pseudo_id.rb', line 29 def recipient_key_set_version @recipient_key_set_version end |
#schema_key_version ⇒ Object (readonly)
Returns the value of attribute schema_key_version.
29 30 31 |
# File 'lib/poly_pseudo/pseudo_id.rb', line 29 def schema_key_version @schema_key_version end |
#schema_version ⇒ Object (readonly)
Returns the value of attribute schema_version.
29 30 31 |
# File 'lib/poly_pseudo/pseudo_id.rb', line 29 def schema_version @schema_version end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
29 30 31 |
# File 'lib/poly_pseudo/pseudo_id.rb', line 29 def type @type end |
Class Method Details
.from_asn1(encoded) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/poly_pseudo/pseudo_id.rb', line 3 def self.from_asn1(encoded) attributes = {} asn1 = OpenSSL::ASN1.decode(Base64.decode64(encoded)) attributes["Type"] = asn1.value[0].value.to_s attributes["SchemaVersion"] = asn1.value[1].value.to_i attributes["SchemaKeyVersion"] = asn1.value[2].value.to_i attributes["Creator"] = asn1.value[3].value.to_s attributes["Recipient"] = asn1.value[4].value.to_s attributes["RecipientKeySetVersion"] = asn1.value[5].value.to_i attributes["Point1"] = OpenSSL::PKey::EC::Point.new(PolyPseudo.config.group, OpenSSL::BN.new(asn1.value[6].value[0].value, 2)) attributes["Point2"] = OpenSSL::PKey::EC::Point.new(PolyPseudo.config.group, OpenSSL::BN.new(asn1.value[6].value[1].value, 2)) attributes["Point3"] = OpenSSL::PKey::EC::Point.new(PolyPseudo.config.group, OpenSSL::BN.new(asn1.value[6].value[2].value, 2)) case attributes["Type"] when /\A.*1\.2\.1\Z/ Identity.new(attributes) when /\A.*1\.2\.2\Z/ Pseudonym.new(attributes) else raise "Invalid type" end end |
Instance Method Details
#initialize(attributes) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/poly_pseudo/pseudo_id.rb', line 31 def initialize(attributes) @type = attributes["Type"] @schema_version = attributes["SchemaVersion"] @schema_key_version = attributes["SchemaKeyVersion"] @recipient = attributes["Creator"] @recipient = attributes["Recipient"] @recipient_key_set_version = attributes["RecipientKeySetVersion"] @point_1 = attributes["Point1"] @point_2 = attributes["Point2"] @point_3 = attributes["Point3"] end |