Save this to a .ps1 file:
# https://blogs.infinitesquare.com/posts/windows/creer-un-certificat-auto-signe-pour-vos-packages-windows-uwp-de-longue-duree
# https://docs.microsoft.com/pt-br/windows/uwp/packaging/create-certificate-package-signing
$pass = Read-Host 'Password?' -AsSecureString
$duree = Read-Host 'Years to expire?'
$subject = Read-Host 'Certificate Subject?'
# Où se trouve t'on ?
$invocation = (Get-Variable MyInvocation).Value
$directorypath = Split-Path $invocation.MyCommand.Path
# on se place au niveau machine
Set-Location Cert:\LocalMachine\My
#un certificat du même sujet existe ?
$thumbprint =Get-ChildItem | Where-Object {$_.subject -match $subject} | Select-Object -first 1 | select -ExpandProperty Thumbprint
if($thumbprint -ne $null)
{
Write-Host "deleting old one "$thumbprint;
Remove-Item -Path $thumbprint;
}
# création d'un nouveau certificat
New-SelfSignedCertificate -NotAfter (Get-Date).AddYears(42) -TextExtension ('2.5.29.37={text}1.3.6.1.5.5.7.3.3','2.5.29.19={text}Subject Type:End Entity') -Type Custom -Subject $subject -KeyUsage DigitalSignature -FriendlyName "Certificat de signature de code" -CertStoreLocation "Cert:\LocalMachine\My"
# récupération du thumbprint du certifcat créé
$thumbprint = Get-ChildItem | Where-Object {$_.subject -match $subject} | Select-Object -first 1 | select -ExpandProperty Thumbprint;
#Export du PFX
Export-PfxCertificate -cert $thumbprint -Password $pass -FilePath $directorypath\MON_CERTIFICAT.pfx
Set-Location C:\temp\UWP
segunda-feira, 26 de março de 2018
sexta-feira, 16 de março de 2018
Convert a .csproj from .Net Class Library to .Net Standard 2.0
<project sdk="Microsoft.NET.Sdk"> <propertygroup> <targetframework>netstandard2.0</targetframework> </propertygroup> </project>
quarta-feira, 14 de março de 2018
Regex Credit Card Brand ?
public function getSupportedBrands() { return array( static::BRAND_VISA => '/^4\d{12}(\d{3})?$/', static::BRAND_MASTERCARD => '/^(5[1-5]\d{4}|677189)\d{10}$/', static::BRAND_DISCOVER => '/^(6011|65\d{2}|64[4-9]\d)\d{12}|(62\d{14})$/', static::BRAND_AMEX => '/^3[47]\d{13}$/', static::BRAND_DINERS_CLUB => '/^3(0[0-5]|[68]\d)\d{11}$/', static::BRAND_JCB => '/^35(28|29|[3-8]\d)\d{12}$/', static::BRAND_SWITCH => '/^6759\d{12}(\d{2,3})?$/', static::BRAND_SOLO => '/^6767\d{12}(\d{2,3})?$/', static::BRAND_DANKORT => '/^5019\d{12}$/', static::BRAND_MAESTRO => '/^(5[06-8]|6\d)\d{10,17}$/', static::BRAND_FORBRUGSFORENINGEN => '/^600722\d{10}$/', static::BRAND_LASER => '/^(6304|6706|6709|6771(?!89))\d{8}(\d{4}|\d{6,7})?$/', ); }
Assinar:
Postagens
(
Atom
)