Module: PQCrypto::Signature
- Defined in:
- lib/pq_crypto/signature.rb
Defined Under Namespace
Classes: Keypair, PublicKey, SecretKey
Constant Summary
collapse
- CANONICAL_ALGORITHM =
:ml_dsa_65
- DETAILS =
{
CANONICAL_ALGORITHM => {
name: CANONICAL_ALGORITHM,
family: Serialization.algorithm_to_family(CANONICAL_ALGORITHM),
oid: Serialization.algorithm_to_oid(CANONICAL_ALGORITHM),
public_key_bytes: SIGN_PUBLIC_KEY_BYTES,
secret_key_bytes: SIGN_SECRET_KEY_BYTES,
signature_bytes: SIGN_BYTES,
description: "ML-DSA-65 signature primitive (FIPS 204).",
}.freeze,
}.freeze
Class Method Summary
collapse
Class Method Details
.details(algorithm) ⇒ Object
60
61
62
|
# File 'lib/pq_crypto/signature.rb', line 60
def details(algorithm)
DETAILS.fetch(validate_algorithm!(algorithm)).dup
end
|
.generate(algorithm = CANONICAL_ALGORITHM) ⇒ Object
.public_key_from_bytes(algorithm, bytes) ⇒ Object
26
27
28
29
|
# File 'lib/pq_crypto/signature.rb', line 26
def public_key_from_bytes(algorithm, bytes)
validate_algorithm!(algorithm)
PublicKey.new(algorithm, bytes)
end
|
.public_key_from_pqc_container_der(der, algorithm = nil) ⇒ Object
36
37
38
39
40
|
# File 'lib/pq_crypto/signature.rb', line 36
def public_key_from_pqc_container_der(der, algorithm = nil)
resolved_algorithm, bytes = Serialization.public_key_from_pqc_container_der(algorithm, der)
validate_algorithm!(resolved_algorithm)
PublicKey.new(resolved_algorithm, bytes)
end
|
.public_key_from_pqc_container_pem(pem, algorithm = nil) ⇒ Object
42
43
44
45
46
|
# File 'lib/pq_crypto/signature.rb', line 42
def public_key_from_pqc_container_pem(pem, algorithm = nil)
resolved_algorithm, bytes = Serialization.public_key_from_pqc_container_pem(algorithm, pem)
validate_algorithm!(resolved_algorithm)
PublicKey.new(resolved_algorithm, bytes)
end
|
.secret_key_from_bytes(algorithm, bytes) ⇒ Object
31
32
33
34
|
# File 'lib/pq_crypto/signature.rb', line 31
def secret_key_from_bytes(algorithm, bytes)
validate_algorithm!(algorithm)
SecretKey.new(algorithm, bytes)
end
|
.secret_key_from_pqc_container_der(der, algorithm = nil) ⇒ Object
48
49
50
51
52
|
# File 'lib/pq_crypto/signature.rb', line 48
def secret_key_from_pqc_container_der(der, algorithm = nil)
resolved_algorithm, bytes = Serialization.secret_key_from_pqc_container_der(algorithm, der)
validate_algorithm!(resolved_algorithm)
SecretKey.new(resolved_algorithm, bytes)
end
|
.secret_key_from_pqc_container_pem(pem, algorithm = nil) ⇒ Object
54
55
56
57
58
|
# File 'lib/pq_crypto/signature.rb', line 54
def secret_key_from_pqc_container_pem(pem, algorithm = nil)
resolved_algorithm, bytes = Serialization.secret_key_from_pqc_container_pem(algorithm, pem)
validate_algorithm!(resolved_algorithm)
SecretKey.new(resolved_algorithm, bytes)
end
|
.supported ⇒ Object
64
65
66
|
# File 'lib/pq_crypto/signature.rb', line 64
def supported
DETAILS.keys.dup
end
|