class

Beryl::Certificates::SubjectPublicKeyInfo

Inherits Reference < Object

A SubjectPublicKeyInfo (RFC 5280 §4.1.2.7): an algorithm identifier and the key bytes.

Reading one checks only its DER structure, as OpenSSL's d2i_X509 and Go's parser do. verification_key decodes the key the first time it is asked for and returns nil for a key Beryl does not use, with the reason in unusable_key_reason:

  • RSA (rsaEncryption with NULL parameters): a modulus of 2,048 to 8,192 bits whose size is a multiple of 8 (CA/Browser Forum baseline requirements §6.1.5), an odd public exponent from 3 to 2^32 - 1;
  • EC (id-ecPublicKey): the named curves P-256 and P-384 (RFC 5480); explicit curve parameters are refused (baseline requirements §7.1.3.1.2);
  • Ed25519 (RFC 8410), with absent parameters.

Constructors

from_der(bytes : Bytes) : SubjectPublicKeyInfo

Reads a DER SubjectPublicKeyInfo on its own, as a PUBLIC KEY PEM block or Wycheproof's publicKeyDer holds it.

Source
read(reader : Encoding::DER::Reader) : SubjectPublicKeyInfo

Reads a SubjectPublicKeyInfo from reader.

Source

Instance methods

algorithm
Source
encoded

The whole SubjectPublicKeyInfo encoding.

Source
key_bytes

The contents of the subjectPublicKey BIT STRING.

Source
parameters

The algorithm parameters element, when present.

Source
unusable_key_reason

Why verification_key is nil, or nil when it is not.

Source
verification_key

The key, decoded, or nil when Beryl does not use it.

Source