From 752a1f3ff841bc8f7908016cfac52df66363b08d Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 8 Apr 2019 12:37:30 +0200 Subject: [PATCH] update cbh blocks --- src/Certificate/Get-CSCertificate.ps1 | 12 ++++++------ src/Certificate/Get-CSPfxCertificate.ps1 | 8 ++++---- src/Certificate/Import-CSCertificate.ps1 | 20 ++++++++++++-------- src/Certificate/Import-CSPfxCertificate.ps1 | 8 ++++---- src/Certificate/New-CSCertAttribute.ps1 | 12 ++++++------ src/Certificate/New-CSCertificate.ps1 | 6 +++--- src/Certificate/Test-CSCertificate.ps1 | 14 +++++++------- src/Certificate/Test-CSPfxCertificate.ps1 | 6 +++--- src/Certificate/Use-CSCertificate.ps1 | 15 ++++++++++++--- src/Item/Get-CredentialStoreItem.ps1 | 13 ++++++------- 10 files changed, 63 insertions(+), 51 deletions(-) diff --git a/src/Certificate/Get-CSCertificate.ps1 b/src/Certificate/Get-CSCertificate.ps1 index fdff236..5bb654b 100644 --- a/src/Certificate/Get-CSCertificate.ps1 +++ b/src/Certificate/Get-CSCertificate.ps1 @@ -1,16 +1,16 @@ function Get-CSCertificate { <# .SYNOPSIS - Returns the current used valid PfX Certificate. + Returns the current used valid PfX certificate. .DESCRIPTION - Use this function to get the available pfx certficate respecting the config hierarchy. + Use this function to get the available pfx certificate respecting the config hierarchy. .PARAMETER Type Select the current credential store type. .PARAMETER Thumbprint - Provice the crednetials thumbprint for the search. + Provide the credentials thumbprint for the search. .INPUTS [None] @@ -22,9 +22,9 @@ function Get-CSCertificate { Get-CSCertificate -Type 'Shared' -Thumbprint '12334456' .NOTES - File Name : Get-CSCertificate.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : Get-CSCertificate.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Certificate/Get-CSPfxCertificate.ps1 b/src/Certificate/Get-CSPfxCertificate.ps1 index be1d0ef..9afe659 100644 --- a/src/Certificate/Get-CSPfxCertificate.ps1 +++ b/src/Certificate/Get-CSPfxCertificate.ps1 @@ -7,7 +7,7 @@ function Get-CSPfxCertificate { You can use this function to get a stored certificate. Search for the object by its unique thumbprint. .PARAMETER Thumbprint - Provide one or more thumprints. + Provide one or more thumbprints. .PARAMETER StoreName Select the store name in which you want to search the certificates. @@ -25,9 +25,9 @@ function Get-CSPfxCertificate { Get-CSPfxCertificate -Thumbprint '12345678' -StoreName 'My' -StoreLocation 'CurrentUser' .NOTES - File Name : Get-CSPfxCertificate.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : Get-CSPfxCertificate.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Certificate/Import-CSCertificate.ps1 b/src/Certificate/Import-CSCertificate.ps1 index af302d7..8cde799 100644 --- a/src/Certificate/Import-CSCertificate.ps1 +++ b/src/Certificate/Import-CSCertificate.ps1 @@ -1,13 +1,17 @@ function Import-CSCertificate { <# .SYNOPSIS - A brief description of the function or script. + Imports a linked certificate to the valid store location. .DESCRIPTION - Describe the function of the script using a single sentence or more. + Import-CSCertificate takes a pfx certificate file and imports it to the supposed certificate store for + private and shared credential stores. - .PARAMETER One - Description of the Parameter (what it does) + .PARAMETER Type + Select between the a private and shared credential store. + + .PARAMETER Path + Provide a valid path to pfx certificate file. .INPUTS Describe the script input parameters (if any), otherwise it may also list the word "[None]". @@ -19,9 +23,9 @@ function Import-CSCertificate { .\Remove-Some-Script.ps1 -One content .NOTES - File Name : Import-CSCertificate.ps1 - Author : fullname - mail - Requires : ModuleNames + - File Name : Import-CSCertificate.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore @@ -52,7 +56,7 @@ function Import-CSCertificate { } process { - # Import to CurrentUser\My stor for windows and linux + # Import to CurrentUser\My store for windows and linux if ($Type -eq 'Private') { Import-CSPfxCertificate -Path $Path -StoreName 'My' -StoreLocation 'CurrentUser' -OpenFlags 'ReadWrite' } diff --git a/src/Certificate/Import-CSPfxCertificate.ps1 b/src/Certificate/Import-CSPfxCertificate.ps1 index 0db05e6..b261c49 100644 --- a/src/Certificate/Import-CSPfxCertificate.ps1 +++ b/src/Certificate/Import-CSPfxCertificate.ps1 @@ -1,11 +1,11 @@ function Import-CSPfxCertificate { <# .SYNOPSIS - adds a given pfx certificate file to current uerers personal certificate store. + Adds a given pfx certificate file to current user's personal certificate store. .DESCRIPTION - This function is used to import existing pfx certificate files. The Import-PFXCertificate cmdle from the - PKI module imports the certficate into a deprecated store. Thus you can't read the private key afterwards or + This function is used to import existing pfx certificate files. The Import-PFXCertificate cmdlet from the + PKI module imports the certificate into a deprecated store. Thus you can't read the private key afterwards or using it for decrypting data. .PARAMETER Path @@ -64,7 +64,7 @@ function Import-CSPfxCertificate { 'ReadWrite', 'MaxAllowed', 'OpenExistingOnly', - 'InclueArchived' + 'IncludeArchived' )] [string]$OpenFlags = 'ReadWrite' ) diff --git a/src/Certificate/New-CSCertAttribute.ps1 b/src/Certificate/New-CSCertAttribute.ps1 index 484a0c5..6311824 100644 --- a/src/Certificate/New-CSCertAttribute.ps1 +++ b/src/Certificate/New-CSCertAttribute.ps1 @@ -1,13 +1,13 @@ function New-CSCertAttribute { <# .SYNOPSIS - Create required data for a certificate signing request. + Creates required data for a certificate signing request. .DESCRIPTION Defines the certificate related properties for an upcoming New-PfxCertificate execution. .PARAMETER Country - Provide a two letter country code. + County code like EN, DE, IT, FR... .PARAMETER State Certificate state value. @@ -35,12 +35,12 @@ function New-CSCertAttribute { ['PSCredentialStore.Certificate.CSRDetails'] .EXAMPLE - New-CSCertAttribute -CSRSubject @{Country = 'DE'; State = 'BW'; City = 'Karlsruhe'; Organization = 'AwesomeIT'; OrganizationalUnitName = '';CommonName = 'MyPrivateCert'} + New-CSCertAttribute -Country 'DE' -State 'BW' -City 'Karlsruhe' -Organization 'AwesomeIT' -OrganizationalUnitName '' -CommonName 'MyPrivateCert' .NOTES - File Name : New-CSCertAttribute.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : New-CSCertAttribute.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Certificate/New-CSCertificate.ps1 b/src/Certificate/New-CSCertificate.ps1 index a4ed69d..91d5554 100644 --- a/src/Certificate/New-CSCertificate.ps1 +++ b/src/Certificate/New-CSCertificate.ps1 @@ -25,9 +25,9 @@ function New-CSCertificate { New-CSCertificate -CRTAttribute $CRTAttribute -KeyName './myprivate.key' -CertName './mycert.pfx' .NOTES - File Name : New-CSCertificate.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : New-CSCertificate.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Certificate/Test-CSCertificate.ps1 b/src/Certificate/Test-CSCertificate.ps1 index 16f1862..4ef34f6 100644 --- a/src/Certificate/Test-CSCertificate.ps1 +++ b/src/Certificate/Test-CSCertificate.ps1 @@ -1,10 +1,10 @@ function Test-CSCertificate { <# .SYNOPSIS - Tests if the linked certificate is stor ein the specified cert stores. + Tests if the linked certificate is store ein the specified cert stores. .DESCRIPTION - Test-CSCertficate should be an easy high level test for the linked certificate. + Test-CSCertificate should be an easy high level test for the linked certificate. .PARAMETER Type Select between 'Private' or 'Shared'. @@ -16,12 +16,12 @@ function Test-CSCertificate { [bool] .EXAMPLE - .\Remove-Some-Script.ps1 -One content + Test-CSCertificate -Type 'Shared' .NOTES - File Name : Test-CSCertificate.ps1 - Author : Marco Blessin - marco.blessing@googlemail.com - Requires : + - File Name : Test-CSCertificate.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore @@ -42,7 +42,7 @@ function Test-CSCertificate { $CS = Get-CredentialStore -Shared } if ($null -ne $CS.PfxCertificate) { - Write-Warning 'There is a Pfx certificate file linked in the store. Certifcates saved in the Cert store will be ignored!' + Write-Warning 'There is a Pfx certificate file linked in the store. Certificates saved in the Cert store will be ignored!' } } diff --git a/src/Certificate/Test-CSPfxCertificate.ps1 b/src/Certificate/Test-CSPfxCertificate.ps1 index a621931..d03fdf5 100644 --- a/src/Certificate/Test-CSPfxCertificate.ps1 +++ b/src/Certificate/Test-CSPfxCertificate.ps1 @@ -7,7 +7,7 @@ function Test-CSPfxCertificate { Use this function to ensure if a certificate is already imported into a given store. .PARAMETER Thumbprint - Provide one or more thumprints. + Provide one or more thumbprints. .PARAMETER StoreName Select the store name in which you want to search the certificates. @@ -22,10 +22,10 @@ function Test-CSPfxCertificate { [bool] .EXAMPLE - Test-CSPfxCertificat -Thumbprint '12345678' -StoreName 'My' -StoreLocation 'CurrentUser' + Test-CSPfxCertificate -Thumbprint '12345678' -StoreName 'My' -StoreLocation 'CurrentUser' .NOTES - File Name : Test-CSPfxCertificat.ps1 + File Name : Test-CSPfxCertificate.ps1 Author : Marco Blessing - marco.blessing@googlemail.com Requires : diff --git a/src/Certificate/Use-CSCertificate.ps1 b/src/Certificate/Use-CSCertificate.ps1 index a11577d..6ac2acd 100644 --- a/src/Certificate/Use-CSCertificate.ps1 +++ b/src/Certificate/Use-CSCertificate.ps1 @@ -1,7 +1,7 @@ function Use-CSCertificate { <# .SYNOPSIS - Links an existing PFX Certifiacte to a CredentialStore. + Links an existing PFX Certificate to a CredentialStore. .DESCRIPTION Linking a certificate is needed if you plan to use the same CredentialStore in cross platform scenarios. @@ -9,6 +9,15 @@ function Use-CSCertificate { .PARAMETER Path Specify the path to the PFX Certificate you want to link for usage. + .PARAMETER CredentialStore + Specify a custom path for a shared credential store. + + .PARAMETER Shared + Use the credential store in shared mode. + + .PARAMETER UserCertStore + Use the given certificate and import it into the corresponding certificate store. + .INPUTS [None] @@ -16,7 +25,7 @@ function Use-CSCertificate { [None] .EXAMPLE - + Use-CSCertificate -Path 'C:\cert.pfx' .NOTES File Name : Use-CSCertificate.ps1 @@ -98,7 +107,7 @@ Make sure you used the same AES keys for encrypting! } if ($UseCertStore) { - Import-CSCertificate -Type ($PSCmdlet.ParameterSetName -eq "Private") -Path $Path + Import-CSCertificate -Type $PSCmdlet.ParameterSetName -Path $Path $CS.Thumbprint = $PfxCertificate.Thumbprint $CS.PfxCertificate = $null } diff --git a/src/Item/Get-CredentialStoreItem.ps1 b/src/Item/Get-CredentialStoreItem.ps1 index 12f06eb..b33dbad 100644 --- a/src/Item/Get-CredentialStoreItem.ps1 +++ b/src/Item/Get-CredentialStoreItem.ps1 @@ -11,8 +11,8 @@ function Get-CredentialStoreItem { Specify the host, for which you would like to change the credentials. .PARAMETER Identifier - Provide a custom identifier to the given remote host key. This enables you to store multiple credentials - for a single remote host entry. For example ad/sys1, ftp/sys1, mssql/sys1 + Provide a custom identifier to the given remote host key. This enables you to store multiple credentials + for a single remote host entry. For example ad/sys1, ftp/sys1, mssql/sys1 .PARAMETER Path Define a custom path to a shared CredentialStore. @@ -31,11 +31,10 @@ function Get-CredentialStoreItem { $myCreds = Get-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" .NOTES - ``` - File Name : Get-CredentialStoreItem.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : Get-CredentialStoreItem.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : dfgdfg + .LINK https://github.com/OCram85/PSCredentialStore #>