{"id":13706425,"url":"https://github.com/syntax-tm/PSCerts","last_synced_at":"2025-05-05T20:31:11.740Z","repository":{"id":65774741,"uuid":"594474803","full_name":"syntax-tm/PSCerts","owner":"syntax-tm","description":"A PowerShell module for managing certificates","archived":false,"fork":false,"pushed_at":"2023-04-27T02:06:24.000Z","size":509,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-13T14:43:16.694Z","etag":null,"topics":["binary-module","certificate","certificates","cmdlet","csharp","iis","permissions","pfx","powershell","security","ssl","x509","x509certificates"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/syntax-tm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-01-28T17:04:57.000Z","updated_at":"2024-10-26T20:32:34.000Z","dependencies_parsed_at":"2024-01-14T20:17:45.231Z","dependency_job_id":"5adeecb2-95ae-47a7-b087-232a75b02922","html_url":"https://github.com/syntax-tm/PSCerts","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tm%2FPSCerts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tm%2FPSCerts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tm%2FPSCerts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tm%2FPSCerts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syntax-tm","download_url":"https://codeload.github.com/syntax-tm/PSCerts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252570991,"owners_count":21769762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary-module","certificate","certificates","cmdlet","csharp","iis","permissions","pfx","powershell","security","ssl","x509","x509certificates"],"created_at":"2024-08-02T22:00:55.878Z","updated_at":"2025-05-05T20:31:11.072Z","avatar_url":"https://github.com/syntax-tm.png","language":"C#","readme":"﻿\u003cp align=\"center\"\u003e\r\n  \u003cimg src=\"images/PSCerts_header_color.png\" /\u003e\r\n\u003c/p\u003e\r\n\r\n\u003chr\u003e\r\n\r\n\u003cp align=\"center\"\u003e\r\n  \u003ca href=\"https://www.powershellgallery.com/packages/PSCerts\"\u003e\r\n    \u003cimg src=\"https://img.shields.io/powershellgallery/p/PSCerts?color=blueviolet\u0026label=PSCerts\u0026logo=powershell\u0026style=for-the-badge\"/\u003e\r\n  \u003c/a\u003e\r\n  \u003ca href=\"https://www.powershellgallery.com/packages/PSCerts\"\u003e\r\n    \u003cimg src=\"https://img.shields.io/powershellgallery/v/PSCerts?color=blue\u0026logo=nuget\u0026style=for-the-badge\"/\u003e\r\n  \u003c/a\u003e\r\n  \u003ca href=\"https://www.powershellgallery.com/api/v2/package/PSCerts/0.0.3\"\u003e\r\n    \u003cimg src=\"https://img.shields.io/powershellgallery/dt/PSCerts?style=for-the-badge\u0026color=blue\"/\u003e\r\n  \u003c/a\u003e\r\n\u003c/p\u003e\r\n\r\nA Powershell module for managing certificates.\r\n\r\n## Install\r\n\r\n```powershell\r\nInstall-Module -Name PSCerts\r\n```\r\n\r\n## TOC\r\n\r\n- [Install](#install)\r\n- [Commands](#commands)\r\n  - [Add-CertPermissions](#add-certpermissions)\r\n  - [Add-SiteBinding](#add-sitebinding)\r\n  - [Get-CertPermissions](#get-certpermissions)\r\n  - [Get-CertPrivateKey](#get-certprivatekey)\r\n  - [Get-CertSummary](#get-certsummary)\r\n  - [Set-CertFriendlyName](#set-certfriendlyname)\r\n- [Building](#building)\r\n- [Testing](#testing)\r\n  - [Unit Tests](#unit-tests)\r\n- [In-Progress](#in-progress)\r\n- [Backlog](#backlog)\r\n- [Reference](#reference)\r\n- [Additional Resources](#additional-resources)\r\n\r\n## Commands\r\n\r\n### Add-CertPermissions\r\n\r\nAdds a [FileSystemAccessRule](https://learn.microsoft.com/en-us/dotnet/api/system.security.accesscontrol.filesystemaccessrule) to a certificate's private key.\r\n\r\n**Usage:**\r\n\r\n```powershell\r\nAdd-CertPermissions [-Certificate] \u003cX509Certificate2\u003e [-Identity] \u003cstring\u003e [-FileSystemRights] \u003cFileSystemRights\u003e [[-AccessType] \u003cAccessControlType\u003e]\r\nAdd-CertPermissions [-Certificate] \u003cX509Certificate2\u003e [-Rule] \u003cFileSystemAccessRule\u003e\r\nAdd-CertPermissions [-Thumbprint] \u003cstring\u003e [-Identity] \u003cstring\u003e [-FileSystemRights] \u003cFileSystemRights\u003e [[-AccessType] \u003cAccessControlType\u003e]\r\nAdd-CertPermissions [-Thumbprint] \u003cstring\u003e [-Rule] \u003cFileSystemAccessRule\u003e\r\n```\r\n\r\n**Examples:**\r\n\r\n```powershell\r\n$cert = Get-Item Cert:\\LocalMachine\\My\\10df834fc47ddfc4d069d2e4fe79e4bf1d6d4dae\r\nAdd-CertPermissions -Certificate $cert -Identity \"Network Service\" -FileSystemRights FullControl -AccessType Allow\r\n\r\nAdd-CertPermissions -Thumbprint \"10df834fc47ddfc4d069d2e4fe79e4bf1d6d4dae\" -Identity \"Network Service\" -FileSystemRights FullControl -AccessType Allow\r\n```\r\n\r\n**Returns:** `None`\r\n\r\n---\r\n\r\n### Add-SiteBinding\r\n\r\nAdds or updates the SSL [Binding](https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.administration.binding) of an IIS site.\r\n\r\n**Usage:**\r\n\r\n```powershell\r\nAdd-SiteBinding [-Certificate] \u003cX509Certificate2\u003e [-Site] \u003cstring\u003e [[-BindingInformation] \u003cstring\u003e] [[-SslFlags] \u003cSslFlags\u003e]\r\nAdd-SiteBinding [-Thumbprint] \u003cstring\u003e [-Site] \u003cstring\u003e [[-BindingInformation] \u003cstring\u003e] [[-SslFlags] \u003cSslFlags\u003e]\r\nAdd-SiteBinding [-FilePath] \u003cstring\u003e [-Password] \u003cstring\u003e [-Site] \u003cstring\u003e [[-BindingInformation] \u003cstring\u003e] [[-SslFlags] \u003cSslFlags\u003e]\r\nAdd-SiteBinding [-FilePath] \u003cstring\u003e [-SecurePassword] \u003cSecureString\u003e [-Site] \u003cstring\u003e [[-BindingInformation] \u003cstring\u003e] [[-SslFlags] \u003cSslFlags\u003e]\r\n```\r\n\r\n**Examples:**\r\n\r\n```powershell\r\n# adds a new SSL binding for the default site\r\nAdd-SiteBinding -Thumbprint '10df834fc47ddfc4d069d2e4fe79e4bf1d6d4dae' -Site 'Default Web Site'\r\n```\r\n\r\n**Returns:** [CertBinding](./src/PSCerts/Models/CertBinding.cs)\r\n\r\n---\r\n\r\n### Get-CertPermissions\r\n\r\nReturns the access control and audit security for a certificate's private key.\r\n\r\n```powershell\r\nGet-CertPermissions [-Certificate] \u003cX509Certificate2\u003e\r\nGet-CertPermissions [-Thumbprint] \u003cstring\u003e\r\n```\r\n\r\n**Examples:**\r\n\r\n```powershell\r\n$cert = Get-Item Cert:\\LocalMachine\\My\\10df834fc47ddfc4d069d2e4fe79e4bf1d6d4dae\r\nGet-CertPermissions -Certificate $cert\r\n\r\nGet-CertPermissions -Thumbprint '10df834fc47ddfc4d069d2e4fe79e4bf1d6d4dae'\r\n```\r\n\r\n**Returns:** [List\\\u003cCertAccessRule\u003e](./src/PSCerts/Models/CertAccessRule.cs)\r\n\r\n---\r\n\r\n### Get-CertPrivateKey\r\n\r\nDetermines the name and location of the certificate's private key.\r\n\r\n**Usage:**\r\n\r\n```powershell\r\nGet-CertPrivateKey [-Certificate] \u003cX509Certificate2\u003e\r\nGet-CertPrivateKey [-Thumbprint] \u003cstring\u003e\r\n```\r\n\r\n**Examples:**\r\n\r\n```powershell\r\n$cert = Get-Item Cert:\\LocalMachine\\My\\10df834fc47ddfc4d069d2e4fe79e4bf1d6d4dae\r\nGet-CertPrivateKey -Certificate $cert\r\n\r\nGet-CertPrivateKey -Thumbprint '10df834fc47ddfc4d069d2e4fe79e4bf1d6d4dae'\r\n```\r\n\r\n**Returns:** [FileInfo](https://learn.microsoft.com/en-us/dotnet/api/system.io.fileinfo)\r\n\r\n---\r\n\r\n### Get-CertSummary\r\n\r\nReturns information about the currently installed certificates.\r\n\r\n**Usage:**\r\n\r\n```powershell\r\nGet-CertSummary [-WithPrivateKey]\r\n```\r\n\r\n**Examples:**\r\n\r\n```powershell\r\nGet-CertSummary\r\nGet-CertSummary -WithPrivateKey\r\n```\r\n\r\n**Returns:** [List\\\u003cCertSummaryItem\u003e](/src/PSCerts/Models/Summary/CertSummaryItem.cs)\r\n\r\n---\r\n\r\n### Set-CertFriendlyName\r\n\r\nUpdates the [FriendlyName](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.x509certificate2.friendlyname) of an [X509Certificate2](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.x509certificate2).\r\n\r\n**Usage:**\r\n\r\n```powershell\r\nSet-CertFriendlyName [-Certificate] \u003cX509Certificate2\u003e [-FriendlyName] \u003cstring\u003e\r\nSet-CertFriendlyName [-Thumbprint] \u003cstring\u003e [-FriendlyName] \u003cstring\u003e\r\n```\r\n\r\n**Examples:**\r\n\r\n```powershell\r\nSet-CertFriendlyName -Thumbprint '10df834fc47ddfc4d069d2e4fe79e4bf1d6d4dae' -FriendlyName \"My Test Cert\"\r\n```\r\n\r\n**Returns:** [X509Certificate2](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.x509certificate2)\r\n\r\n---\r\n\r\n## Building\r\n\r\nThe `build.ps1` script will build and publish both the CLR (`net462`) and Core CLR (`netstandard2.0`) frameworks.\r\n\r\n```powershell\r\n.\\src\\scripts\\build.ps1\r\n```\r\n\r\nOnce that is done, the module and all required assemblies, type data, manifest, etc will be in the `src\\publish` directory. If you are wanting to import the module you can use this directory but it's recommended to use the [Test](#test) script.\r\n\r\n## Testing\r\n\r\nBecause **PSCerts** is a binary module, importing the assembly from the build or publish directory will keep you from being able to buiild and/or deploy. Simply removing the module from the session with `Remove-Module` is **not** enough to remove the actual assembly reference. To get around this, `test.ps1` will run `build.ps1` and copy everything to `src\\test`. You can load the assembly from the `test` path and still be able run build and publish.\r\n\r\nIf you are developing in VSCode, which is recommnded, you can configure the PowerShell add-on to create a temporary console for each debugging session. This prevents locking the binary and the script will automatically re-import the module with each session.\r\n\r\n```json\r\n\"powershell.debugging.createTemporaryIntegratedConsole\": true\r\n```\r\n\r\n### Unit Tests\r\n\r\n`PSCerts.Tests` is the unit testing project. It's very much a work-in-progress.\r\n\r\n---\r\n\r\n## In-Progress\r\n\r\n\u003cdetails\u003e\r\n  \u003csummary\u003e\u003cb\u003eImport-Certs\u003c/b\u003e\u003c/summary\u003e\r\n\r\n**certfile (Required):** The path to a certificate file\r\n**stores (Required):** One or more stores the certificate will be imported to\r\n**permissions:** File permissions for the private key (Optional)\r\n**password:** The password for the certificate.\r\n\r\nThe `type` indicates how to handle the `value` property (see below).\r\n\r\n- Type: `text`\r\n  - The \u003cstrong\u003evalue\u003c/strong\u003e is the password. \u003ci\u003e(Not recommended)\u003c/i\u003e\r\n  - [Example](/docs/examples/ImportCerts/basic.json)\r\n- Type: `file`\r\n  - The \u003cstrong\u003evalue\u003c/strong\u003e is the path to a file that contains the password.\r\n  - [Example](/docs/examples/ImportCerts/passwordFromFile.json)\r\n- Type: `env`\r\n  - The \u003cstrong\u003evalue\u003c/strong\u003e is the name of an environment variable containing the password.\r\n  - [Example](/docs/examples/ImportCerts/passwordFromEnv.json)\r\n\r\n\u003c/details\u003e\r\n\r\n## Backlog\r\n\r\n- [ ] Finish documentation for `Import-Certs`\r\n- [ ] Add Cmdlet help information\r\n- [ ] Add unit tests\r\n- [ ] Add version history, release notes, etc. to the module manifest\r\n- [ ] Move non-Cmdlet code to a separate project\r\n- [ ] Create NuGet package for the core functionality\r\n- [ ] Come up with better names for the model classes (and others)\r\n- [ ] Create documentation (wiki)\r\n\r\n## Reference\r\n\r\n- [Version History](/CHANGELOG.txt)\r\n\r\n## Additional Resources\r\n\r\n- [Key Storage and Retrieval](https://learn.microsoft.com/en-us/windows/win32/seccng/key-storage-and-retrieval)\r\n","funding_links":[],"categories":["C# #"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntax-tm%2FPSCerts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyntax-tm%2FPSCerts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntax-tm%2FPSCerts/lists"}