# Worker DTLS files best practices?

**URL:** <https://mediasoup.discourse.group/t/worker-dtls-files-best-practices/1133>\
**Category:** mediasoup libraries\
**Created:** [May 31, 2020, 7:04pm UTC](https://mediasoup.discourse.group/t/worker-dtls-files-best-practices/1133 "2020-05-31T19:04:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xplatsolutions](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/xplatsolutions/32/939_2.png) [@xplatsolutions](https://mediasoup.discourse.group/u/xplatsolutions)\
**Post date:** [May 31, 2020, 7:04pm UTC](https://mediasoup.discourse.group/t/worker-dtls-files-best-practices/1133/1 "2020-05-31T19:04:44Z")

</div>

Any best practices in generating DTLS certificate and the private key files for worker?

```auto
const worker = await mediasoup.createWorker(
  {
    logLevel : "warn",
    dtlsCertificateFile : "/home/foo/dtls-cert.pem",
    dtlsPrivateKeyFile : "/home/foo/dtls-key.pem"
  });

```

Not the greatest with this context, I’d appreciate even specific to mediasoup server guidelines.

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [May 31, 2020, 7:39pm UTC](https://mediasoup.discourse.group/t/worker-dtls-files-best-practices/1133/2 "2020-05-31T19:39:12Z")

</div>

I see no reason to provide DTLS certificate over letting mediasoup generate a random one.

---

<div class="post-metadata">

**Author:** ![xplatsolutions](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/xplatsolutions/32/939_2.png) [@xplatsolutions](https://mediasoup.discourse.group/u/xplatsolutions)\
**Post date:** [May 31, 2020, 7:41pm UTC](https://mediasoup.discourse.group/t/worker-dtls-files-best-practices/1133/3 "2020-05-31T19:41:35Z")

</div>

Nice! I removed the parameters and server started.  
What about production? I assume I set to the certificate generated for the server.

EDIT: I might be confusing the DTLS certificate with the web server certificate and the above statement might be irrelevant.

---

<div class="post-metadata">

**Author:** ![nazar-pc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/nazar-pc/32/369_2.png) [@nazar-pc](https://mediasoup.discourse.group/u/nazar-pc)\
**Post date:** [June 1, 2020, 2:16am UTC](https://mediasoup.discourse.group/t/worker-dtls-files-best-practices/1133/4 "2020-06-01T02:16:09Z")

</div>

You may want to use that to make mutual peer authentication, but you need to have control over certificates on both ends and there is no such API in the browser. Browsers and most other software (with some obscure exceptions) generate those automatically.  
So unless you really know that you need it, just don’t bother and let server generate it for you automatically.

---

<div class="post-metadata">

**Author:** ![xplatsolutions](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/xplatsolutions/32/939_2.png) [@xplatsolutions](https://mediasoup.discourse.group/u/xplatsolutions)\
**Post date:** [June 1, 2020, 3:02am UTC](https://mediasoup.discourse.group/t/worker-dtls-files-best-practices/1133/5 "2020-06-01T03:02:26Z")

</div>

I’ll go with it, totally fine and thanks for the explanation 🙂
