# RTCCertificate

DTLS certificates of a connection and the key algorithms to generate them with.

### *class* webrtc.models.rtc_certificate.RTCCertificateExpiration(expires=None)

The lifetime of a generated certificate. It’s the base of [`webrtc.Algorithm`](#webrtc.models.rtc_certificate.Algorithm).

See [MDN: RTCPeerConnection/generateCertificate_static](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/generateCertificate_static).

* **Parameters:**
  **expires** ([`int`](https://docs.python.org/3/builtins/functions.html#int), optional) – In how many milliseconds the certificate expires, capped at a year.
  It’s 30 days if omitted.

### *class* webrtc.models.rtc_certificate.Algorithm(name, \*, expires=None)

A key algorithm by its WebCrypto name, for [`webrtc.RTCPeerConnection.generate_certificate()`](../interfaces/rtc_peer_connection.md#webrtc.interfaces.rtc_peer_connection.RTCPeerConnection.generate_certificate).

`'ECDSA'` uses the P-256 curve. `'RSASSA-PKCS1-v1_5'` needs an [`webrtc.RsaHashedKeyGenParams`](#webrtc.models.rtc_certificate.RsaHashedKeyGenParams) instead.

* **Parameters:**
  * **name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – The name, like `'ECDSA'`, compared case-insensitively.
  * **expires** ([`int`](https://docs.python.org/3/builtins/functions.html#int), optional) – In how many milliseconds the certificate expires (keyword-only).

### *class* webrtc.models.rtc_certificate.EcKeyGenParams(name, named_curve, \*, expires=None)

An ECDSA key algorithm with an explicit curve.

See [MDN: EcKeyGenParams](https://developer.mozilla.org/en-US/docs/Web/API/EcKeyGenParams).

* **Parameters:**
  * **name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – `'ECDSA'`.
  * **named_curve** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – The curve, of which only `'P-256'` is supported.
  * **expires** ([`int`](https://docs.python.org/3/builtins/functions.html#int), optional) – In how many milliseconds the certificate expires (keyword-only).

### *class* webrtc.models.rtc_certificate.RsaHashedKeyGenParams(name, \*, modulus_length, public_exponent, hash, expires=None)

An RSA key algorithm. Every member but the name is keyword-only.

See [MDN: RsaHashedKeyGenParams](https://developer.mozilla.org/en-US/docs/Web/API/RsaHashedKeyGenParams).

* **Parameters:**
  * **name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – `'RSASSA-PKCS1-v1_5'`.
  * **modulus_length** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – The length of the modulus in bits, like 2048.
  * **public_exponent** ([`bytes`](https://docs.python.org/3/builtins/stdtypes.html#bytes)) – The public exponent, big-endian, like `bytes([1, 0, 1])` for 65537.
  * **hash** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str) or [`webrtc.Algorithm`](#webrtc.models.rtc_certificate.Algorithm)) – The hash function, of which only `'SHA-256'` is supported.
  * **expires** ([`int`](https://docs.python.org/3/builtins/functions.html#int), optional) – In how many milliseconds the certificate expires.

### webrtc.models.rtc_certificate.AlgorithmIdentifier

A key algorithm, or its name (like `'ECDSA'`), as [`webrtc.RTCPeerConnection.generate_certificate()`](../interfaces/rtc_peer_connection.md#webrtc.interfaces.rtc_peer_connection.RTCPeerConnection.generate_certificate) takes it

alias of [`str`](https://docs.python.org/3/builtins/stdtypes.html#str) | [`Algorithm`](#webrtc.models.rtc_certificate.Algorithm)

### *class* webrtc.models.rtc_certificate.RTCDtlsFingerprint(algorithm=None, value=None)

A fingerprint of a certificate, as the `a=fingerprint` line of SDP carries it. It’s immutable.

See [MDN: RTCCertificate/getFingerprints](https://developer.mozilla.org/en-US/docs/Web/API/RTCCertificate/getFingerprints).

* **Parameters:**
  * **algorithm** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str), optional) – The hash function, like `'sha-256'`.
  * **value** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str), optional) – The hash as lowercase hex bytes separated with colons.

### *class* webrtc.models.rtc_certificate.RTCCertificate(native_obj=None)

A certificate and its private key, which a connection authenticates with in DTLS.

Only [`webrtc.RTCPeerConnection.generate_certificate()`](../interfaces/rtc_peer_connection.md#webrtc.interfaces.rtc_peer_connection.RTCPeerConnection.generate_certificate) creates it, and a connection uses it through
`webrtc.RTCConfiguration.certificates`. A connection without one generates its own.
See [MDN: RTCCertificate](https://developer.mozilla.org/en-US/docs/Web/API/RTCCertificate).

#### *property* expires *: [float](https://docs.python.org/3/builtins/functions.html#float)*

When the certificate expires, in milliseconds since the Unix epoch.

A configuration with an expired certificate raises [`webrtc.InvalidAccessError`](../exceptions.md#webrtc.exceptions.InvalidAccessError).
See [MDN: RTCCertificate/expires](https://developer.mozilla.org/en-US/docs/Web/API/RTCCertificate/expires).

* **Type:**
  [`float`](https://docs.python.org/3/builtins/functions.html#float)

#### get_fingerprints()

Returns the fingerprints of the certificate, as the remote peer sees them in the SDP.

See [MDN: RTCCertificate/getFingerprints](https://developer.mozilla.org/en-US/docs/Web/API/RTCCertificate/getFingerprints).

* **Returns:**
  [`list`](https://docs.python.org/3/builtins/stdtypes.html#list) of [`webrtc.RTCDtlsFingerprint`](#webrtc.models.rtc_certificate.RTCDtlsFingerprint) – The fingerprints.
* **Return type:**
  [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[*RTCDtlsFingerprint*](#webrtc.models.rtc_certificate.RTCDtlsFingerprint)]
