• Version 2.4.1
  • Published
  • 25.4 kB
  • 2 dependencies
  • MIT license


npm i selfsigned
yarn add selfsigned
pnpm add selfsigned


Generate self signed certificates private and public keys



function generate

generate: {
(attrs?: pki.CertificateField[], opts?: SelfsignedOptions): GenerateResult;
attrs?: pki.CertificateField[],
opts?: SelfsignedOptions,
done?: (err: Error, result: GenerateResult) => any
): void;


    interface GenerateResult

    interface GenerateResult {}

      property cert

      cert: string;

        property fingerprint

        fingerprint: string;

          property private

          private: string;

            property public

            public: string;

              interface SelfsignedOptions

              interface SelfsignedOptions {}

                property algorithm

                algorithm?: string;
                • The signature algorithm sha256 or sha1 "sha1"

                property clientCertificate

                clientCertificate?: boolean;
                • generate client cert signed by the original key false

                property clientCertificateCN

                clientCertificateCN?: string;
                • client certificate's common name "John Doe jdoe123"

                property clientCertificateKeySize

                clientCertificateKeySize?: number;
                • the size for the client private key in bits 1024

                property days

                days?: number;
                • The number of days before expiration


                property extensions

                extensions?: any[];
                • additional extensions for the certificate

                property keySize

                keySize?: number;
                • the size for the private key in bits 1024

                property notBeforeDate

                notBeforeDate?: Date;
                • The date before which the certificate should not be valid


                property pkcs7

                pkcs7?: boolean;
                • include PKCS#7 as part of the output false

                Package Files (1)

                Dependencies (2)

                Dev Dependencies (2)

                Peer Dependencies (0)

                No peer dependencies.


                To add a badge like this badgeto your package's README, use the codes available below.

                You may also use to create a custom badge linking to

                • Markdown
                • HTML
                  <a href=""><img src="" alt=""></a>