Class RootCertificate

extends Object
Trusted Root TLS Certificate used to verify a server's identity.
It is composed of a x509 certificate and a fingerprint.

Class summary


constructor --name/string= --fingerprint/int= raw/any
Constructs a RootCertificate from a binary DER-endoded certificate or an ASCII PEM-encoded certificate.

Constructors

constructor --name/string=null --fingerprint/int=null raw/any
Constructs a RootCertificate from a binary DER-endoded certificate or an ASCII PEM-encoded certificate.
The raw certificate is in unparsed form, either in PEM (ASCII) format or in DER format. Usually you would use a byte array constant in DER format, which will stay in flash on embedded platforms, using very little memory. More memory is used when it is added to a TLS socket. If it is installed in the process with install then no extra memory is used until it is needed to complete a TLS handshake.

Methods

install -> none
Add a trusted root certificate that can be used for all TLS connections.
This method is an alternative to adding root certificates to individual TLS sockets, or using the --root-certificates argument on the HTTP client. If you add root certificates to a specific connection then these global certificates are not consulted for that connection, not even as a fallback.
The trusted roots added with this method have a "subject" field that is used to match with the "issuer" field that the server provides. Only matching roots are tried when attempting to verify a server certificate. The "AuthorityKeyIdentifier" and "SubjectKeyIdentifer" extensions are not supported.

operator == other/any -> bool
Whether this object is equal to the other.
By default, identical is used for equality.
Inheritance
Classes overwrite this operator to get an equality specific to their needs. Equality operators often compare the type and field contents. For example:

class Pin:
  number/int

  constructor .number:

  operator == other:
    if other is not Pin: return false
    return number == other.number
A class doesn't have to follow the above format, but it must keep the operator in sync with any hash-code method. That is, if a class has a hash-code member, then the equality and hash-code must agree. If two instances are equal (a == b), then their hash codes must also be equal (a.hash-code == b.hash-code).

Fields

raw / any