Module: PQCrypto::Serialization
- Defined in:
- lib/pq_crypto/serialization.rb
Constant Summary collapse
- ALGORITHM_METADATA =
AlgorithmRegistry..freeze
Class Method Summary collapse
- .algorithm_metadata(algorithm) ⇒ Object
- .algorithm_to_family(algorithm) ⇒ Object
- .algorithm_to_oid(algorithm) ⇒ Object
- .public_key_from_pqc_container_der(expected_algorithm, der) ⇒ Object
- .public_key_from_pqc_container_pem(expected_algorithm, pem) ⇒ Object
- .public_key_to_pqc_container_der(algorithm, bytes) ⇒ Object
- .public_key_to_pqc_container_pem(algorithm, bytes) ⇒ Object
- .secret_key_from_pqc_container_der(expected_algorithm, der) ⇒ Object
- .secret_key_from_pqc_container_pem(expected_algorithm, pem) ⇒ Object
- .secret_key_to_pqc_container_der(algorithm, bytes) ⇒ Object
- .secret_key_to_pqc_container_pem(algorithm, bytes) ⇒ Object
Class Method Details
.algorithm_metadata(algorithm) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/pq_crypto/serialization.rb', line 8 def (algorithm) = ALGORITHM_METADATA[algorithm] raise SerializationError, "Unsupported serialization algorithm: #{algorithm.inspect}" unless end |
.algorithm_to_family(algorithm) ⇒ Object
19 20 21 |
# File 'lib/pq_crypto/serialization.rb', line 19 def algorithm_to_family(algorithm) (algorithm).fetch(:family) end |
.algorithm_to_oid(algorithm) ⇒ Object
15 16 17 |
# File 'lib/pq_crypto/serialization.rb', line 15 def algorithm_to_oid(algorithm) (algorithm).fetch(:oid) end |
.public_key_from_pqc_container_der(expected_algorithm, der) ⇒ Object
39 40 41 |
# File 'lib/pq_crypto/serialization.rb', line 39 def public_key_from_pqc_container_der(expected_algorithm, der) load(:native_public_key_from_pqc_container_der, expected_algorithm, der) end |
.public_key_from_pqc_container_pem(expected_algorithm, pem) ⇒ Object
43 44 45 |
# File 'lib/pq_crypto/serialization.rb', line 43 def public_key_from_pqc_container_pem(expected_algorithm, pem) load(:native_public_key_from_pqc_container_pem, expected_algorithm, pem) end |
.public_key_to_pqc_container_der(algorithm, bytes) ⇒ Object
23 24 25 |
# File 'lib/pq_crypto/serialization.rb', line 23 def public_key_to_pqc_container_der(algorithm, bytes) dump(:native_public_key_to_pqc_container_der, algorithm, bytes) end |
.public_key_to_pqc_container_pem(algorithm, bytes) ⇒ Object
27 28 29 |
# File 'lib/pq_crypto/serialization.rb', line 27 def public_key_to_pqc_container_pem(algorithm, bytes) dump(:native_public_key_to_pqc_container_pem, algorithm, bytes) end |
.secret_key_from_pqc_container_der(expected_algorithm, der) ⇒ Object
47 48 49 |
# File 'lib/pq_crypto/serialization.rb', line 47 def secret_key_from_pqc_container_der(expected_algorithm, der) load(:native_secret_key_from_pqc_container_der, expected_algorithm, der) end |
.secret_key_from_pqc_container_pem(expected_algorithm, pem) ⇒ Object
51 52 53 |
# File 'lib/pq_crypto/serialization.rb', line 51 def secret_key_from_pqc_container_pem(expected_algorithm, pem) load(:native_secret_key_from_pqc_container_pem, expected_algorithm, pem) end |
.secret_key_to_pqc_container_der(algorithm, bytes) ⇒ Object
31 32 33 |
# File 'lib/pq_crypto/serialization.rb', line 31 def secret_key_to_pqc_container_der(algorithm, bytes) dump(:native_secret_key_to_pqc_container_der, algorithm, bytes) end |
.secret_key_to_pqc_container_pem(algorithm, bytes) ⇒ Object
35 36 37 |
# File 'lib/pq_crypto/serialization.rb', line 35 def secret_key_to_pqc_container_pem(algorithm, bytes) dump(:native_secret_key_to_pqc_container_pem, algorithm, bytes) end |