@@ -5,56 +5,36 @@ environment:
5
5
UnitsNetPfxSecret :
6
6
secure : Dibuvlff8E8XYIVHZFh+y632RN23ZamvKEJE9NNf/GM=
7
7
install :
8
- - ps : >-
8
+ - ps : |
9
9
Write-Host -ForegroundColor Yellow "Install 'secure-file' tool..."
10
-
11
10
nuget install secure-file -ExcludeVersion
12
11
13
-
14
12
Write-Host -ForegroundColor Yellow "Decrypt UnitsNet.pfx..."
15
-
16
13
.\secure-file\tools\secure-file -decrypt Build\UnitsNet.pfx.enc -secret $env:UnitsNetPfxEncSecret
17
14
18
-
19
15
$pfx = Resolve-Path "Build\UnitsNet.pfx"
20
-
21
16
$password = $env:UnitsNetPfxSecret
22
-
23
17
$keyContainerName = "VS_KEY_53797375DF3695DD"
24
18
25
-
26
19
# Import certificate
27
-
28
20
Write-Host -ForegroundColor Yellow "Import $pfx ..."
29
-
30
21
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
31
-
32
22
$cert.Import($pfx, $password, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable)
33
-
34
23
$exportPrivateKeyInformation = $true
35
-
36
24
$certXml = $cert.PrivateKey.ToXmlString($exportPrivateKeyInformation)
37
25
38
-
39
26
$csp = New-Object System.Security.Cryptography.CspParameters
40
-
41
27
$csp.KeyContainerName = $keyContainerName
42
-
43
28
$csp.Flags = [System.Security.Cryptography.CspProviderFlags]::UseMachineKeyStore -bor [System.Security.Cryptography.CspProviderFlags]::NoPrompt # -bor is biwise or
44
-
45
29
$csp.KeyNumber = [System.Security.Cryptography.KeyNumber]::Signature
46
30
47
-
48
31
$rsa = New-Object System.Security.Cryptography.RSACryptoServiceProvider $csp
49
-
50
32
$rsa.FromXmlString($certXml)
51
-
52
33
$rsa.Clear()
53
34
54
-
55
35
Write-Output "Sucesfully imported $pfx into StrongName CSP store"
56
36
build_script :
57
- - ps : >-
37
+ - ps : |
58
38
#####################################
59
39
# Build, test, pack and deploy nugets
60
40
#####################################
0 commit comments