Skip to main content

    Self-Signed Certificates: What They Are, Risks, and When to Use One

    What a self-signed certificate is, how it differs from a CA-signed certificate, the warnings it triggers, and when self-signing is the right choice.

    MS
    My-SSL
    ·
    14 min read
    ·
    Published June 9, 2026
    ·
    Last updated October 25, 2026

    The short answer

    A self-signed certificate is a certificate signed with its own private key, so the issuer and the subject are the same. It encrypts exactly as well as a CA-issued certificate, but no browser, operating system or library trusts it until someone installs it on that client. Every client that has not been set up reports an error instead: NET::ERR_CERT_AUTHORITY_INVALID in Chrome, curl error 60, or Node's DEPTH_ZERO_SELF_SIGNED_CERT. Use one on localhost, in a closed lab, or between two systems you configure yourself. Anything strangers connect to needs a certificate from a publicly trusted CA.

    Three kinds of certificate and who trusts them, stackedThe same three cases as the wide figure, top to bottom: self-signed, trusted by no store; private CA or mkcert, highlighted in gold, trusted only on machines you set up; public CA, trusted by default.Same encryption, different trustSelf-signedIssuer = SubjectStore: In no trust storeEvery client warnsERR_CERT_AUTHORITY_INVALIDPrivate CA or mkcertLeaf → your own rootStore: Only on machines you set upTrusted on those machinesWarns everywhere elsePublic CALeaf → intermediate → rootStore: Preinstalled everywhereTrusted by defaultMax 200 days since March 2026The cipher suite is the same in all three
    Fixing a self-signed warning never means changing the encryption: it means getting the issuing root into the trust store of every client that connects.

    What is a self-signed certificate?

    A self-signed certificate is an X.509 certificate whose signature can be checked with the public key inside the same certificate. RFC 5280 defines it in two steps: a self-issued certificate is one where “the issuer and subject are the same entity”, and a self-signed certificate is a self-issued one whose signature verifies with its own key. Nobody else vouched for it.

    Apart from that, it looks like any other certificate: a subject name, a public key, validity dates and, if you add them, Subject Alternative Names. Two quick ways to recognise one: the Issuer and Subject lines are identical, and openssl verify without a trust file stops at depth 0:

    bash
    $ openssl x509 -in selfsigned.crt -noout -subject -issuer
    subject=CN = dev.internal.example
    issuer=CN = dev.internal.example
    
    $ openssl verify selfsigned.crt
    CN = dev.internal.example
    error 18 at 0 depth lookup: self-signed certificate
    error selfsigned.crt: verification failed

    Error 18 is the plain case: the server's own certificate is self-signed. Its close relative, error 19, comes up in the certificate-chain section below. The root of the private CA we used in our tests was self-signed as well; what separates a trusted chain from an untrusted one is whether the client already holds the root. Our guide to how certificate chains are built covers the rest of that path.

    What does each client say when it meets a self-signed certificate?

    Every client that verifies certificates rejects an untrusted self-signed certificate, but each one words the rejection differently, which is why the same problem gets searched for under a dozen names. We served one self-signed certificate (and, separately, a leaf plus a private root) from openssl s_server on 25 October 2026 and recorded what each client printed:

    Client (version tested)Self-signed server certificateLeaf + private root sent in the chain
    Chromium 153net::ERR_CERT_AUTHORITY_INVALIDnet::ERR_CERT_AUTHORITY_INVALID
    curl 8.5.0 (OpenSSL 3.0.13)(60) SSL certificate problem: self-signed certificate(60) … self-signed certificate in certificate chain
    Python 3.13CERTIFICATE_VERIFY_FAILED … self-signed certificate… self-signed certificate in certificate chain
    Node.js 22DEPTH_ZERO_SELF_SIGNED_CERTSELF_SIGNED_CERT_IN_CHAIN
    Go 1.24x509: certificate signed by unknown authoritysame
    Java 21PKIX path building failed … unable to find valid certification path to requested targetsame

    Firefox, which we did not drive in this test, reports the case as MOZILLA_PKIX_ERROR_SELF_SIGNED_CERT (“The certificate is not trusted because it is self-signed”) and a private-CA chain as SEC_ERROR_UNKNOWN_ISSUER, according to its own error strings. In a browser the user can usually click past the warning. Libraries like curl, Python and Go have no such button: the request fails, which is why the Java version of this problem has its own troubleshooting guide.

    The browser click-through disappears too once a domain uses HSTS. RFC 6797 tells the browser to end the connection on any certificate error for a known HSTS host and to offer “no user recourse”, so a self-signed certificate on a subdomain of a site that sends includeSubDomains cannot be bypassed at all. More on that in our HSTS guide.

    What does “self-signed certificate in certificate chain” mean?

    “Self-signed certificate in certificate chain” (OpenSSL error 19, Node's SELF_SIGNED_CERT_IN_CHAIN) means the server's own certificate was signed by someone else, but the chain ends in a self-signed root the client does not trust. The leaf is fine; the client simply has never heard of the root at the top.

    bash
    $ openssl verify -untrusted root.crt leaf.crt
    CN = Example Internal Root CA
    error 19 at 1 depth lookup: self-signed certificate in certificate chain

    It shows up in three situations. A company runs its own CA, so internal servers chain to a root that only managed laptops trust. A corporate proxy inspects TLS and re-signs every site with its own root, which the operating system trusts but a separate tool such as npm, git, pip or a Docker container does not. Or the server is misconfigured and sends a root the client has never seen. The fix in the first two cases is to give that tool the root as an extra CA file (curl --cacert, Node NODE_EXTRA_CA_CERTS, Python cafile=), not to turn verification off.

    Do not copy the usual answer. NODE_TLS_REJECT_UNAUTHORIZED=0, curl -k, verify=False and git config http.sslVerify false silence the error by switching off verification for every host the process talks to, not just the internal one. They tend to survive the trip into production code.

    Why can a trusted self-signed certificate still fail?

    A trusted self-signed certificate can still fail because clients check more than the issuer: they also check that the hostname is in the Subject Alternative Name extension and that the certificate's structure meets their rules. We built four self-signed certificates and private roots in different ways, added each one to the client's trust store, and connected with four TLS stacks.

    Which clients reject a trusted certificate, by how it was madeFour cards. req -x509 with a SAN: accepted by all four clients. No SAN: rejected by Chromium and Go. Old three-step recipe, version 1 with no SAN: rejected by Chromium, Go and Python 3.13. Private root without keyUsage: rejected by Python 3.13 only.Trusted, and still rejectedreq -x509 with SANAccepted by all four clientsNo SAN (Common Name only)Rejected by:Chromium 153, Go 1.24Old 3-step recipe (v1, no SAN)Rejected by:Chromium 153, Go 1.24, Python 3.13Private root without keyUsageRejected by:Python 3.13
    “I trusted it and it still fails” is usually the certificate, not the trust store: the old copy-paste recipes produce certificates that newer clients refuse even after they have been told to trust them.
    • No SAN. Chrome stopped falling back to the Common Name in Chrome 58, in 2017; Chromium reported net::ERR_CERT_COMMON_NAME_INVALID and Go said x509: certificate relies on legacy Common Name field, use SANs instead. curl, Node and Python still accepted it, so a certificate can pass every command-line test and fail in the browser. Apple also requires the DNS name in the SAN for every TLS server certificate.
    • Version 1 certificates. The three-step recipe still found in many tutorials, genrsa, then req -new, then x509 -req -signkey, produced an X.509 version 1 certificate with no extensions on OpenSSL 3.0.13, so it has no SAN either: Chromium and Go rejected it with the Common Name errors above. Python 3.13 rejected it for being version 1, as invalid CA certificate, while Python 3.12 accepted the same file.
    • Private roots without keyUsage. A root made with a plain openssl req -x509 has no keyUsage extension. Python 3.13 refused it with CA cert does not include key usage extension; adding -addext "keyUsage=critical,keyCertSign,cRLSign" fixed it.

    The Python failures come from a default that changed in Python 3.13: ssl.create_default_context() now sets VERIFY_X509_STRICT, so certificates that worked for years break after an interpreter upgrade with no change on the server. Reissue the certificate correctly rather than clearing the flag.

    How long can a self-signed certificate be valid?

    A self-signed certificate is valid for whatever -days value you give it, but “unlimited” is wrong in practice. The CA/Browser Forum limit, 200 days since March 15, 2026 and falling to 100 days in 2027 and 47 days in 2029, applies only to publicly trusted certificates. Apple's rules reach further. For certificates issued after July 1, 2019, iOS 13 and macOS 10.15 and later require a validity of 825 days or fewer and the serverAuth extended key usage. Apple states those rules for all TLS server certificates, while its separate 398-day limit explicitly leaves out roots that a user or administrator added, so a certificate you trusted by hand is still held to 825 days.

    So the ten-year self-signed certificate that loaded without complaint in our Chromium test on Linux will not satisfy Apple's 825-day rule, and the req -x509 command in this guide adds no serverAuth EKU unless you ask for it. If Macs, iPhones or iPads will connect, keep -days at 825 or below and add extendedKeyUsage=serverAuth. A short life also keeps the key rotating, which matters because a self-signed certificate cannot be revoked: if the key leaks, the only fix is to remove the certificate from every client that trusts it.

    Why do vulnerability scanners flag self-signed certificates?

    Scanners flag a self-signed certificate because a client cannot tell it apart from one an attacker generated. Tenable's Nessus reports it as plugin 57582, “SSL Self-Signed Certificate”, and any chain that ends in an unknown root as plugin 51192, “SSL Certificate Cannot Be Trusted”. Both are rated Medium, and both give the same remedy: “Purchase or generate a proper SSL certificate for this service.”

    There are two honest ways to close the finding. For a host that outside users, customers or partners reach, replace the certificate with one from a public CA; our publicly trusted SSL certificates cover single names, wildcards and multi-domain sets. For a host only your own devices use, issue its certificate from a private CA whose root is deployed to those devices and to the scanner, then record the exception. If the finding is on a payment system, read the PCI rule below first.

    When is a self-signed certificate the right choice?

    A self-signed certificate is the right choice when no second party needs to be convinced who you are: you control every client, or there is only one.

    SituationSelf-signed?Why
    localhost while developingYes, or mkcertOne machine, one person, nothing to prove
    Isolated lab or test networkYesNo outside users and no path to production
    Appliance admin page on first boot (router, NAS, hypervisor)Only until replacedIt lets you reach the page over HTTPS; swap it before others use it
    Two services you configure, with the certificate pinned on both endsYesTrust is set up out of band, as with certificate pinning
    Many internal services and staff laptopsNo: private CAOne root to distribute instead of one certificate per service
    Public website, API used by others, mail serverNo: public CAClients you do not control will refuse or warn
    Cardholder data over a public networkNoOutside the PCI DSS 4.2.1 exception (below)

    PCI DSS v4.x requirement 4.2.1 says that for card numbers sent over open, public networks “only trusted keys and certificates are accepted.” Its applicability notes, as printed in the PCI Security Standards Council's self-assessment questionnaires for v4.0 and v4.0.1, accept a self-signed certificate only if it is “issued by an internal CA within the organization”, its author is confirmed, and it is verified and unexpired. The v4.0 notes go on to rule out certificates whose “issued by” and “issued to” names are the same. A private CA can meet the exception; a stand-alone self-signed certificate, with no CA behind it, does not. Our PCI DSS certificate guide covers the rest of requirement 4.

    How do you create a self-signed certificate that clients accept?

    Create it in one OpenSSL command with the hostname in a Subject Alternative Name, the serverAuth extended key usage, and a validity Apple devices accept. On OpenSSL 3.0.13 the command below produced a version 3 certificate with basicConstraints critical, CA:TRUE and matching key identifiers, which passed in every client we tested once trusted.

    bash
    # Key + self-signed certificate: SAN, serverAuth EKU, 825 days (Apple's ceiling)
    openssl req -x509 -newkey rsa:2048 -nodes \
      -keyout selfsigned.key \
      -out selfsigned.crt \
      -days 825 \
      -subj "/CN=dev.internal.example" \
      -addext "subjectAltName=DNS:dev.internal.example,DNS:localhost,IP:127.0.0.1" \
      -addext "extendedKeyUsage=serverAuth"
    
    # Check it: issuer = subject, SAN present
    openssl x509 -in selfsigned.crt -noout -subject -issuer -ext subjectAltName

    -x509 makes a certificate instead of a CSR, and -nodes leaves the key unencrypted so a server can start without a passphrase prompt. Set its permissions to 600 and keep it out of version control: whoever holds it can impersonate the service to every client that trusts the certificate. On Windows, New-SelfSignedCertificate does the same job, and Microsoft describes it as creating a certificate “for testing purposes”. Our OpenSSL commands cheat sheet has the inspection and conversion commands.

    How do you renew a self-signed certificate?

    You cannot extend a self-signed certificate; you create a new one and replace the copy in every trust store that held the old one. Reusing the key and subject does not spare you that step. We reissued our test certificate with the same key and subject, openssl req -x509 -key selfsigned.key …, and left the old file in place as the trusted copy:

    • curl and Python 3.13 rejected the new certificate with “self-signed certificate”.
    • Chromium accepted it; its trust store held a certificate with the same name and key, which appears to be enough for it.
    • With a new key, every client rejected it.

    That split is how a renewal “works in the browser” and breaks the cron job. With a private CA the problem disappears: you reissue the leaf, and clients keep trusting the root they already have. For publicly trusted certificates, see how renewal works with a CA.

    Should you use mkcert, a private CA or a public certificate instead?

    Use mkcert for one developer machine, a private CA for many internal machines, and a public certificate for anything with a public DNS name. Each one removes the warning in a different place.

    mkcert for a development machine

    mkcert creates a local CA, installs it in the system trust store (and Firefox's, where present), and issues certificates from it that your browser accepts without a warning. Its README warns that the generated rootCA-key.pem “gives complete power to intercept secure requests”, so it never leaves that machine.

    bash
    mkcert -install                      # create and trust the local CA (once)
    mkcert dev.local localhost 127.0.0.1 ::1

    A private CA for internal infrastructure

    For more than a handful of internal services, run a small CA (Microsoft AD CS, step-ca or HashiCorp Vault, for example) and push one root to every managed device through group policy or device management. You get warning-free HTTPS inside the network plus what self-signing lacks: an inventory, expiry dates you control, and the ability to revoke. Give the root a keyUsage extension, as shown above, or Python 3.13 clients will refuse it. Our PKI guide explains the parts.

    A publicly trusted certificate

    If the host has a public DNS name, even one used only by staff, a publicly trusted certificate removes the trust problem on every device, including phones and contractors' laptops you will never manage. Free DV certificates through ACME work where you can automate renewal: see the free certificate options and Certbot automation. Hosts with no public name at all have fewer options, covered in certificates for internal server names. Replacing a self-signed certificate is an ordinary issuance: a CSR with a fresh key, domain validation, then installing the certificate with its intermediate, which you can confirm with our SSL checker.

    Can you use a self-signed code signing certificate?

    You can sign code with a self-signed certificate, but only machines where you installed that certificate will recognise the signature. On everyone else's Windows PC, Microsoft says a file signed with a self-signed certificate gets the same SmartScreen treatment as an unsigned one: the “Windows protected your PC” screen and a “Run anyway” choice that company policy can remove. That makes it fine for internal tools deployed to managed machines and test builds, and wrong for software you ship to customers. The options in between, from open-source certificates to cloud signing, are compared in our guide to free and low-cost signing routes, and the Unknown Publisher warning explains what users see. For public releases you need a code signing certificate from a trusted CA.

    Updated October 25, 2026: rewritten around tests run that day (error output from six clients, three ways a trusted certificate still fails, and what happens on renewal); added Apple's 825-day rule, the Nessus findings, the PCI DSS 4.2.1 wording on self-signed certificates, and self-signed code signing; removed claims we could not source.

    Frequently Asked Questions

    Quick answers to related questions.

    Is a self-signed certificate secure?

    The encryption is as strong as with any other certificate: the TLS version and cipher suite do not depend on who signed the certificate. What a self-signed certificate cannot give is proof of identity. An attacker who intercepts the connection can present a self-signed certificate of their own, and a client that was told to click through or skip verification has no way to tell the two apart. It is secure only where every client has been given the exact certificate, or its issuing root, in advance.

    Do self-signed certificates expire?

    Yes. A self-signed certificate has a notAfter date like any other, set by the -days value when it is created, and clients reject it after that date. Because no CA issued it, nobody sends a renewal reminder either, so put the expiry date into whatever monitoring you already run for your other certificates.

    Can I use a self-signed certificate on a public website?

    It will work only for visitors who click through a full-page warning, and not at all for browsers that already have an HSTS policy for the domain, API clients with default verification, or most mobile apps. If cost is the reason, a free publicly trusted DV certificate removes the warning without the risk. If the server has no public DNS name, see the options for internal server names instead.

    How do I stop the browser warning for an internal site?

    Make the browser trust the issuer. For one machine, install the certificate in that machine's trust store (Windows certificate store, macOS Keychain, or the Linux CA bundle) or let mkcert create and install a local CA. For many machines, run a private CA and push its root certificate to every device through group policy or device management. Clicking through the warning every day is the one option that trains people to ignore the warning everywhere else.

    Still Have Questions?

    Contact our support team with questions about certificates, installation, or technical issues.

    Replacing a self-signed certificate on a public host?

    A domain-validated certificate is the shortest route from a warning to a normal padlock: you prove control of the domain and Certum lists automatic issue within about an hour. See DV SSL certificates for the plans and what validation involves.