Publish version 1.0.x #45

Merged
OCram85 merged 31 commits from dev into master 2019-04-29 16:05:44 +02:00
10 changed files with 63 additions and 51 deletions
Showing only changes of commit 752a1f3ff8 - Show all commits

View File

@ -1,16 +1,16 @@
function Get-CSCertificate { function Get-CSCertificate {
<# <#
.SYNOPSIS .SYNOPSIS
Returns the current used valid PfX Certificate. Returns the current used valid PfX certificate.
.DESCRIPTION .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 .PARAMETER Type
Select the current credential store type. Select the current credential store type.
.PARAMETER Thumbprint .PARAMETER Thumbprint
Provice the crednetials thumbprint for the search. Provide the credentials thumbprint for the search.
.INPUTS .INPUTS
[None] [None]
@ -22,9 +22,9 @@ function Get-CSCertificate {
Get-CSCertificate -Type 'Shared' -Thumbprint '12334456' Get-CSCertificate -Type 'Shared' -Thumbprint '12334456'
.NOTES .NOTES
File Name : Get-CSCertificate.ps1 - File Name : Get-CSCertificate.ps1
Author : Marco Blessing - marco.blessing@googlemail.com - Author : Marco Blessing - marco.blessing@googlemail.com
Requires : - Requires :
.LINK .LINK
https://github.com/OCram85/PSCredentialStore https://github.com/OCram85/PSCredentialStore

View File

@ -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. You can use this function to get a stored certificate. Search for the object by its unique thumbprint.
.PARAMETER Thumbprint .PARAMETER Thumbprint
Provide one or more thumprints. Provide one or more thumbprints.
.PARAMETER StoreName .PARAMETER StoreName
Select the store name in which you want to search the certificates. 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' Get-CSPfxCertificate -Thumbprint '12345678' -StoreName 'My' -StoreLocation 'CurrentUser'
.NOTES .NOTES
File Name : Get-CSPfxCertificate.ps1 - File Name : Get-CSPfxCertificate.ps1
Author : Marco Blessing - marco.blessing@googlemail.com - Author : Marco Blessing - marco.blessing@googlemail.com
Requires : - Requires :
.LINK .LINK
https://github.com/OCram85/PSCredentialStore https://github.com/OCram85/PSCredentialStore

View File

@ -1,13 +1,17 @@
function Import-CSCertificate { function Import-CSCertificate {
<# <#
.SYNOPSIS .SYNOPSIS
A brief description of the function or script. Imports a linked certificate to the valid store location.
.DESCRIPTION .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 .PARAMETER Type
Description of the Parameter (what it does) Select between the a private and shared credential store.
.PARAMETER Path
Provide a valid path to pfx certificate file.
.INPUTS .INPUTS
Describe the script input parameters (if any), otherwise it may also list the word "[None]". 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 .\Remove-Some-Script.ps1 -One content
.NOTES .NOTES
File Name : Import-CSCertificate.ps1 - File Name : Import-CSCertificate.ps1
Author : fullname - mail - Author : Marco Blessing - marco.blessing@googlemail.com
Requires : ModuleNames - Requires :
.LINK .LINK
https://github.com/OCram85/PSCredentialStore https://github.com/OCram85/PSCredentialStore
@ -52,7 +56,7 @@ function Import-CSCertificate {
} }
process { process {
# Import to CurrentUser\My stor for windows and linux # Import to CurrentUser\My store for windows and linux
if ($Type -eq 'Private') { if ($Type -eq 'Private') {
Import-CSPfxCertificate -Path $Path -StoreName 'My' -StoreLocation 'CurrentUser' -OpenFlags 'ReadWrite' Import-CSPfxCertificate -Path $Path -StoreName 'My' -StoreLocation 'CurrentUser' -OpenFlags 'ReadWrite'
} }

View File

@ -1,11 +1,11 @@
function Import-CSPfxCertificate { function Import-CSPfxCertificate {
<# <#
.SYNOPSIS .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 .DESCRIPTION
This function is used to import existing pfx certificate files. The Import-PFXCertificate cmdle from the This function is used to import existing pfx certificate files. The Import-PFXCertificate cmdlet from the
PKI module imports the certficate into a deprecated store. Thus you can't read the private key afterwards or PKI module imports the certificate into a deprecated store. Thus you can't read the private key afterwards or
using it for decrypting data. using it for decrypting data.
.PARAMETER Path .PARAMETER Path
@ -64,7 +64,7 @@ function Import-CSPfxCertificate {
'ReadWrite', 'ReadWrite',
'MaxAllowed', 'MaxAllowed',
'OpenExistingOnly', 'OpenExistingOnly',
'InclueArchived' 'IncludeArchived'
)] )]
[string]$OpenFlags = 'ReadWrite' [string]$OpenFlags = 'ReadWrite'
) )

View File

@ -1,13 +1,13 @@
function New-CSCertAttribute { function New-CSCertAttribute {
<# <#
.SYNOPSIS .SYNOPSIS
Create required data for a certificate signing request. Creates required data for a certificate signing request.
.DESCRIPTION .DESCRIPTION
Defines the certificate related properties for an upcoming New-PfxCertificate execution. Defines the certificate related properties for an upcoming New-PfxCertificate execution.
.PARAMETER Country .PARAMETER Country
Provide a two letter country code. County code like EN, DE, IT, FR...
.PARAMETER State .PARAMETER State
Certificate state value. Certificate state value.
@ -35,12 +35,12 @@ function New-CSCertAttribute {
['PSCredentialStore.Certificate.CSRDetails'] ['PSCredentialStore.Certificate.CSRDetails']
.EXAMPLE .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 .NOTES
File Name : New-CSCertAttribute.ps1 - File Name : New-CSCertAttribute.ps1
Author : Marco Blessing - marco.blessing@googlemail.com - Author : Marco Blessing - marco.blessing@googlemail.com
Requires : - Requires :
.LINK .LINK
https://github.com/OCram85/PSCredentialStore https://github.com/OCram85/PSCredentialStore

View File

@ -25,9 +25,9 @@ function New-CSCertificate {
New-CSCertificate -CRTAttribute $CRTAttribute -KeyName './myprivate.key' -CertName './mycert.pfx' New-CSCertificate -CRTAttribute $CRTAttribute -KeyName './myprivate.key' -CertName './mycert.pfx'
.NOTES .NOTES
File Name : New-CSCertificate.ps1 - File Name : New-CSCertificate.ps1
Author : Marco Blessing - marco.blessing@googlemail.com - Author : Marco Blessing - marco.blessing@googlemail.com
Requires : - Requires :
.LINK .LINK
https://github.com/OCram85/PSCredentialStore https://github.com/OCram85/PSCredentialStore

View File

@ -1,10 +1,10 @@
function Test-CSCertificate { function Test-CSCertificate {
<# <#
.SYNOPSIS .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 .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 .PARAMETER Type
Select between 'Private' or 'Shared'. Select between 'Private' or 'Shared'.
@ -16,12 +16,12 @@ function Test-CSCertificate {
[bool] [bool]
.EXAMPLE .EXAMPLE
.\Remove-Some-Script.ps1 -One content Test-CSCertificate -Type 'Shared'
.NOTES .NOTES
File Name : Test-CSCertificate.ps1 - File Name : Test-CSCertificate.ps1
Author : Marco Blessin - marco.blessing@googlemail.com - Author : Marco Blessing - marco.blessing@googlemail.com
Requires : - Requires :
.LINK .LINK
https://github.com/OCram85/PSCredentialStore https://github.com/OCram85/PSCredentialStore
@ -42,7 +42,7 @@ function Test-CSCertificate {
$CS = Get-CredentialStore -Shared $CS = Get-CredentialStore -Shared
} }
if ($null -ne $CS.PfxCertificate) { 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!'
} }
} }

View File

@ -7,7 +7,7 @@ function Test-CSPfxCertificate {
Use this function to ensure if a certificate is already imported into a given store. Use this function to ensure if a certificate is already imported into a given store.
.PARAMETER Thumbprint .PARAMETER Thumbprint
Provide one or more thumprints. Provide one or more thumbprints.
.PARAMETER StoreName .PARAMETER StoreName
Select the store name in which you want to search the certificates. Select the store name in which you want to search the certificates.
@ -22,10 +22,10 @@ function Test-CSPfxCertificate {
[bool] [bool]
.EXAMPLE .EXAMPLE
Test-CSPfxCertificat -Thumbprint '12345678' -StoreName 'My' -StoreLocation 'CurrentUser' Test-CSPfxCertificate -Thumbprint '12345678' -StoreName 'My' -StoreLocation 'CurrentUser'
.NOTES .NOTES
File Name : Test-CSPfxCertificat.ps1 File Name : Test-CSPfxCertificate.ps1
Author : Marco Blessing - marco.blessing@googlemail.com Author : Marco Blessing - marco.blessing@googlemail.com
Requires : Requires :

View File

@ -1,7 +1,7 @@
function Use-CSCertificate { function Use-CSCertificate {
<# <#
.SYNOPSIS .SYNOPSIS
Links an existing PFX Certifiacte to a CredentialStore. Links an existing PFX Certificate to a CredentialStore.
.DESCRIPTION .DESCRIPTION
Linking a certificate is needed if you plan to use the same CredentialStore in cross platform scenarios. 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 .PARAMETER Path
Specify the path to the PFX Certificate you want to link for usage. 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 .INPUTS
[None] [None]
@ -16,7 +25,7 @@ function Use-CSCertificate {
[None] [None]
.EXAMPLE .EXAMPLE
Use-CSCertificate -Path 'C:\cert.pfx'
.NOTES .NOTES
File Name : Use-CSCertificate.ps1 File Name : Use-CSCertificate.ps1
@ -98,7 +107,7 @@ Make sure you used the same AES keys for encrypting!
} }
if ($UseCertStore) { if ($UseCertStore) {
Import-CSCertificate -Type ($PSCmdlet.ParameterSetName -eq "Private") -Path $Path Import-CSCertificate -Type $PSCmdlet.ParameterSetName -Path $Path
$CS.Thumbprint = $PfxCertificate.Thumbprint $CS.Thumbprint = $PfxCertificate.Thumbprint
$CS.PfxCertificate = $null $CS.PfxCertificate = $null
} }

View File

@ -11,8 +11,8 @@ function Get-CredentialStoreItem {
Specify the host, for which you would like to change the credentials. Specify the host, for which you would like to change the credentials.
.PARAMETER Identifier .PARAMETER Identifier
Provide a custom identifier to the given remote host key. This enables you to store multiple credentials 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 for a single remote host entry. For example ad/sys1, ftp/sys1, mssql/sys1
.PARAMETER Path .PARAMETER Path
Define a custom path to a shared CredentialStore. 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" $myCreds = Get-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local"
.NOTES .NOTES
``` - File Name : Get-CredentialStoreItem.ps1
File Name : Get-CredentialStoreItem.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com
Author : Marco Blessing - marco.blessing@googlemail.com - Requires : dfgdfg
Requires :
```
.LINK .LINK
https://github.com/OCram85/PSCredentialStore https://github.com/OCram85/PSCredentialStore
#> #>