Skip to content

Commit 327b62c

Browse files
authored
Merge nanoframework/release-v1.0.4
2 parents 9966e94 + 8b83569 commit 327b62c

File tree

9 files changed

+116
-29
lines changed

9 files changed

+116
-29
lines changed

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,33 @@
11
# Change Log
22

3+
## [**Changes available only in 'Preview' NuGet packages:**](https://github.com/nanoframework/lib-nanoFramework.System.Net/tree/HEAD)
4+
5+
[Full Changelog](https://github.com/nanoframework/lib-nanoFramework.System.Net/compare/v1.0.3-preview-003...HEAD)
6+
37
## [v1.0.0](https://github.com/nanoframework/lib-nanoFramework.System.Net/tree/v1.0.0) (2018-10-17)
48
[Full Changelog](https://github.com/nanoframework/lib-nanoFramework.System.Net/compare/v1.0.2-preview-028...HEAD)
59

610
**Documentation and other chores:**
711

12+
- Update 2 NuGet dependencies [\#59](https://github.com/nanoframework/lib-nanoFramework.System.Net/pull/59)
13+
14+
## [v1.0.3-preview-003](https://github.com/nanoframework/lib-nanoFramework.System.Net/tree/v1.0.3-preview-003) (2019-01-03)
15+
[Full Changelog](https://github.com/nanoframework/lib-nanoFramework.System.Net/compare/v1.0.2...v1.0.3-preview-003)
16+
17+
**Implemented enhancements:**
18+
19+
- Add CertificateManager class [\#51](https://github.com/nanoframework/lib-nanoFramework.System.Net/pull/51) [[Breaking-Change](https://github.com/nanoframework/lib-nanoFramework.System.Net/labels/Breaking-Change)]
20+
21+
**Documentation and other chores:**
22+
23+
- Merge back from Release v1.0.2 [\#58](https://github.com/nanoframework/lib-nanoFramework.System.Net/pull/58)
24+
25+
## [v1.0.2](https://github.com/nanoframework/lib-nanoFramework.System.Net/tree/v1.0.2) (2018-12-15)
26+
[Full Changelog](https://github.com/nanoframework/lib-nanoFramework.System.Net/compare/v1.0.2-preview-028...v1.0.2)
27+
28+
**Documentation and other chores:**
29+
30+
- Release v1.0.2 [\#57](https://github.com/nanoframework/lib-nanoFramework.System.Net/pull/57)
831
- Update 2 NuGet dependencies [\#56](https://github.com/nanoframework/lib-nanoFramework.System.Net/pull/56)
932

1033
## [v1.0.2-preview-028](https://github.com/nanoframework/lib-nanoFramework.System.Net/tree/v1.0.2-preview-028) (2018-12-13)

source/nanoFramework.System.Net.DELIVERABLES.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
<tags>
1919
</tags>
2020
<dependencies>
21-
<dependency id="nanoFramework.CoreLibrary" version="[1.1.0]" />
22-
<dependency id="nanoFramework.Runtime.Events" version="[1.0.2]" />
21+
<dependency id="nanoFramework.CoreLibrary" version="[1.1.1]" />
22+
<dependency id="nanoFramework.Runtime.Events" version="[1.0.4]" />
2323
</dependencies>
2424
</metadata>
2525
<files>

source/nanoFramework.System.Net.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
<summary>nanoFramework.System.Net assembly for nanoFramework C# projects</summary>
1818
<tags>nanoFramework C# csharp netmf netnf nanoFramework.System.Net</tags>
1919
<dependencies>
20-
<dependency id="nanoFramework.CoreLibrary" version="[1.1.0]" />
21-
<dependency id="nanoFramework.Runtime.Events" version="[1.0.2]" />
20+
<dependency id="nanoFramework.CoreLibrary" version="[1.1.1]" />
21+
<dependency id="nanoFramework.Runtime.Events" version="[1.0.4]" />
2222
</dependencies>
2323
</metadata>
2424
<files>
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
//
2+
// Copyright (c) 2018 The nanoFramework project contributors
3+
// Portions Copyright (c) Microsoft Corporation. All rights reserved.
4+
// See LICENSE file in the project root for full license information.
5+
//
6+
7+
using System.Runtime.CompilerServices;
8+
using System.Security.Cryptography.X509Certificates;
9+
using System.Text;
10+
11+
namespace System.Net.Security
12+
{
13+
/// <summary>
14+
/// Provides an interface to the device certificate store to manage <see cref="X509Certificate"/>.
15+
/// </summary>
16+
public static class CertificateManager
17+
{
18+
/// <summary>
19+
/// Adds a Certificate Authority Root bundle <see cref="X509Certificate"/> to the store.
20+
/// If there is already a CA Root bundle it will be replaced with this one.
21+
/// </summary>
22+
/// <param name="ca">The Certificate Authority certificate bundle to be added store.</param>
23+
/// <returns>
24+
/// True if the certificate bundle was correctly added to the device certificate store.
25+
/// </returns>
26+
/// <remarks>
27+
/// This method is exclusive of nanoFramework. There is no equivalent in .NET framework.
28+
/// </remarks>
29+
public static bool AddCaCertificateBundle(X509Certificate[] ca)
30+
{
31+
// build a string concatenating all the certificates
32+
StringBuilder bundle = new StringBuilder();
33+
34+
foreach(X509Certificate cert in ca)
35+
{
36+
byte[] certRaw = cert.GetRawCertData();
37+
38+
// remove the terminator from each string
39+
bundle.Append(Encoding.UTF8.GetString(certRaw, 0, certRaw.Length - 1));
40+
}
41+
42+
// add terminator
43+
bundle.Append("\0");
44+
45+
return AddCaCertificateBundle(bundle.ToString());
46+
}
47+
48+
/// <summary>
49+
/// Adds a Certificate Authority Root bundle <see cref="X509Certificate"/> to the store.
50+
/// If there is already a CA Root bundle it will be replaced with this one.
51+
/// </summary>
52+
/// <param name="ca">The Certificate Authority certificate bundle to be added store.</param>
53+
/// <returns>
54+
/// True if the certificate bundle was correctly added to the device certificate store.
55+
/// </returns>
56+
/// <remarks>
57+
/// This method is exclusive of nanoFramework. There is no equivalent in .NET framework.
58+
/// </remarks>
59+
public static bool AddCaCertificateBundle(string ca)
60+
{
61+
return AddCaCertificateBundle(Encoding.UTF8.GetBytes(ca));
62+
}
63+
64+
/// <summary>
65+
/// Adds a Certificate Authority Root bundle <see cref="X509Certificate"/> to the store.
66+
/// If there is already a CA Root bundle it will be replaced with this one.
67+
/// </summary>
68+
/// <param name="ca">The Certificate Authority certificate bundle to be added store.</param>
69+
/// <returns>
70+
/// True if the certificate bundle was correctly added to the device certificate store.
71+
/// </returns>
72+
/// <remarks>
73+
/// This method is exclusive of nanoFramework. There is no equivalent in .NET framework.
74+
/// </remarks>
75+
[MethodImpl(MethodImplOptions.InternalCall)]
76+
public static extern bool AddCaCertificateBundle(byte[] ca);
77+
}
78+
}

source/nanoFramework.System.Net/Security/NetworkSecurity.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ internal static class SslNative
7575
[MethodImplAttribute(MethodImplOptions.InternalCall)]
7676
internal static extern int SecureClientInit(int sslProtocols, int sslCertVerify, X509Certificate certificate, X509Certificate ca);
7777

78-
[MethodImplAttribute(MethodImplOptions.InternalCall)]
79-
internal static extern void UpdateCertificates(int contextHandle, X509Certificate certificate, X509Certificate[] ca);
80-
8178
[MethodImplAttribute(MethodImplOptions.InternalCall)]
8279
internal static extern void SecureAccept(int contextHandle, object socket);
8380

source/nanoFramework.System.Net/Security/SslStream.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,6 @@ public void AuthenticateAsServer(X509Certificate serverCertificate, bool clientC
113113
Authenticate(true, "", null, serverCertificate, sslProtocols);
114114
}
115115

116-
/// <summary>
117-
/// Updates the SSL stack to use updated certificates.
118-
/// </summary>
119-
/// <param name="cert">The personal certificate to update.</param>
120-
/// <param name="ca">The certificate authority certificate to update.</param>
121-
public void UpdateCertificates(X509Certificate cert, X509Certificate[] ca)
122-
{
123-
if(_sslContext == -1) throw new InvalidOperationException();
124-
125-
SslNative.UpdateCertificates(_sslContext, cert, ca);
126-
}
127-
128116
internal void Authenticate(bool isServer, string targetHost, X509Certificate certificate, X509Certificate ca, params SslProtocols[] sslProtocols)
129117
{
130118
SslProtocols vers = (SslProtocols)0;

source/nanoFramework.System.Net/System.Net.nfproj

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@
4545
<Name>System.Net</Name>
4646
</PropertyGroup>
4747
<ItemGroup>
48-
<NFMDP_PE_LoadHints Include="..\packages\nanoFramework.CoreLibrary.1.1.0\lib\mscorlib.dll">
48+
<NFMDP_PE_LoadHints Include="..\packages\nanoFramework.CoreLibrary.1.1.1\lib\mscorlib.dll">
4949
<InProject>false</InProject>
5050
</NFMDP_PE_LoadHints>
51-
<NFMDP_PE_LoadHints Include="..\packages\nanoFramework.Runtime.Events.1.0.2\lib\nanoFramework.Runtime.Events.dll">
51+
<NFMDP_PE_LoadHints Include="..\packages\nanoFramework.Runtime.Events.1.0.4\lib\nanoFramework.Runtime.Events.dll">
5252
<InProject>false</InProject>
5353
</NFMDP_PE_LoadHints>
5454
</ItemGroup>
@@ -66,6 +66,7 @@
6666
<Compile Include="NetworkInformation\NetworkInterfaceType.cs" />
6767
<Compile Include="NetworkInformation\Wireless80211Configuration.cs" />
6868
<Compile Include="Properties\AssemblyInfo.cs" />
69+
<Compile Include="Security\CertificateManager.cs" />
6970
<Compile Include="Security\NetworkSecurity.cs" />
7071
<Compile Include="Security\SslStream.cs" />
7172
<Compile Include="SocketAddress.cs" />
@@ -92,12 +93,12 @@
9293
<Content Include="README.txt" />
9394
</ItemGroup>
9495
<ItemGroup>
95-
<Reference Include="mscorlib, Version=1.1.0.4, Culture=neutral, PublicKeyToken=c07d481e9758c731">
96-
<HintPath>..\packages\nanoFramework.CoreLibrary.1.1.0\lib\mscorlib.dll</HintPath>
96+
<Reference Include="mscorlib, Version=1.1.1.7, Culture=neutral, PublicKeyToken=c07d481e9758c731">
97+
<HintPath>..\packages\nanoFramework.CoreLibrary.1.1.1\lib\mscorlib.dll</HintPath>
9798
<Private>True</Private>
9899
</Reference>
99-
<Reference Include="nanoFramework.Runtime.Events, Version=1.0.2.2, Culture=neutral, PublicKeyToken=c07d481e9758c731">
100-
<HintPath>..\packages\nanoFramework.Runtime.Events.1.0.2\lib\nanoFramework.Runtime.Events.dll</HintPath>
100+
<Reference Include="nanoFramework.Runtime.Events, Version=1.0.4.3, Culture=neutral, PublicKeyToken=c07d481e9758c731">
101+
<HintPath>..\packages\nanoFramework.Runtime.Events.1.0.4\lib\nanoFramework.Runtime.Events.dll</HintPath>
101102
<Private>True</Private>
102103
</Reference>
103104
</ItemGroup>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="nanoFramework.CoreLibrary" version="1.1.0" targetFramework="netnanoframework10" />
4-
<package id="nanoFramework.Runtime.Events" version="1.0.2" targetFramework="netnanoframework10" />
3+
<package id="nanoFramework.CoreLibrary" version="1.1.1" targetFramework="netnanoframework10" />
4+
<package id="nanoFramework.Runtime.Events" version="1.0.4" targetFramework="netnanoframework10" />
55
<package id="Nerdbank.GitVersioning" version="3.0.4-beta" developmentDependency="true" targetFramework="netnanoframework10" />
66
</packages>

source/version.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3-
"version": "1.0.2",
3+
"version": "1.0.4",
44
"assemblyVersion": {
55
"precision": "revision"
66
},
@@ -16,4 +16,4 @@
1616
"setVersionVariables": true,
1717
"setAllVariables": true
1818
}
19-
}
19+
}

0 commit comments

Comments
 (0)