gencodesigncert

Generate a secure code signing certificate.


Version    : 1.0
File Name  : gencodesigncert.ps1
Author     : Adewale Azeez - iamthecarisma@gmail.com
Date       : Jan-09-2020

Generate a code signing certificate to sign your application, powershell script e.t.c. After generating the certificate, it is exported into the output folder specified in the third parameter.

If a certificate already exist with the same Subject name the old certificate is removed and replaced with the new certificate that is generated.

Syntax

gencodesigncert [-cert_name] <String> [-expiry_year_] <Int32>
[-output_folder_path] <String> [-password_] <String> [<CommonParameters>]

Parameters

-cert_name :String

attr

value

Required?

true

Position?

1

Default value

Accept pipeline input?

false

Accept wildcard characters?

false

-expiry_year_ :Int32

attr

value

Required?

true

Position?

2

Default value

0

Accept pipeline input?

false

Accept wildcard characters?

false

-output_folder_path :String

attr

value

Required?

true

Position?

3

Default value

Accept pipeline input?

false

Accept wildcard characters?

false

-password_ :String

attr

value

Required?

true

Position?

4

Default value

Accept pipeline input?

false

Accept wildcard characters?

false

CommonParameters

This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).

Inputs

System.String System.int32 System.String System.String

Outputs

System.String

EXAMPLE 1

gencodesigncert 'Cronux' 3 ./dist/ mypassword

This generates the Cronux certificate in ‘cert:/LocalMachine/My’ and exports Cronux.pfx to ./dist/ folder. The generated certificate expires after 3 years.

EXAMPLE 2

gencodesigncert 'My Code Signer' 1 ./dist/ mypassword

This generates the Cronux certificate in ‘cert:/LocalMachine/My’ and exports Cronux.pfx to ./dist/ folder. The generated certificate expires after 1 years.