Skip to content

Commit 4f0d8d0

Browse files
committed
Merge branch 'release-0.7.1' into fwd-0.7.1
2 parents 83bd064 + 2236753 commit 4f0d8d0

File tree

6 files changed

+31
-12
lines changed

6 files changed

+31
-12
lines changed

AstarteDeviceSDKCSharp/AstarteDeviceSDKCSharp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ SPDX-License-Identifier: Apache-2.0 -->
1111
<RootNamespace>AstarteDeviceSDKCSharp</RootNamespace>
1212
<ImplicitUsings>enable</ImplicitUsings>
1313
<Nullable>enable</Nullable>
14-
<Version>0.7.0</Version>
14+
<Version>0.7.1</Version>
1515
</PropertyGroup>
1616

1717
<ItemGroup>

AstarteDeviceSDKCSharp/AstartePairingHandler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* This file is part of Astarte.
33
*
4-
* Copyright 2023 SECO Mind Srl
4+
* Copyright 2025 SECO Mind Srl
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -36,14 +36,14 @@ public class AstartePairingHandler
3636
private TimeSpan _timeOut;
3737

3838
public AstartePairingHandler(string pairingUrl, string astarteRealm, string deviceId,
39-
string credentialSecret, AstarteCryptoStore astarteCryptoStore, TimeSpan timeout)
39+
string credentialSecret, AstarteCryptoStore astarteCryptoStore, TimeSpan timeout, bool ignoreSSLErrors = false)
4040
{
4141
_astarteRealm = astarteRealm;
4242
_deviceId = deviceId;
4343
_credentialSecret = credentialSecret;
4444
_cryptoStore = astarteCryptoStore;
4545
_timeOut = timeout;
46-
_AstartePairingService = new AstartePairingService(pairingUrl, astarteRealm, timeout);
46+
_AstartePairingService = new AstartePairingService(pairingUrl, astarteRealm, timeout, ignoreSSLErrors);
4747

4848
_certificate = _cryptoStore.GetCertificate();
4949
if (_certificate == null)

AstarteDeviceSDKCSharp/AstartePairingService.cs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* This file is part of Astarte.
33
*
4-
* Copyright 2023 SECO Mind Srl
4+
* Copyright 2025 SECO Mind Srl
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -39,14 +39,27 @@ public class AstartePairingService
3939
private readonly string _astarteRealm;
4040
private readonly HttpClient _httpClient;
4141

42-
public AstartePairingService(string pairingUrl, string astarteRealm, TimeSpan timeOut)
42+
public AstartePairingService(string pairingUrl, string astarteRealm, TimeSpan timeOut, bool ignoreSSLErrors = false)
4343
{
4444
_astarteRealm = astarteRealm;
4545
_pairingUrl = new Uri($"{pairingUrl.TrimEnd('/')}/v1");
46-
_httpClient = new HttpClient
46+
47+
if (ignoreSSLErrors)
4748
{
48-
Timeout = timeOut
49-
};
49+
var httpHandler = new HttpClientHandler
50+
{
51+
ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => true
52+
};
53+
_httpClient = new HttpClient(httpHandler);
54+
55+
}
56+
else
57+
{
58+
_httpClient = new HttpClient();
59+
}
60+
61+
_httpClient.Timeout = timeOut;
62+
5063
}
5164

5265
internal async Task<List<AstarteTransport>> ReloadTransports(string credentialSecret,

AstarteDeviceSDKCSharp/Device/AstarteDevice.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* This file is part of Astarte.
33
*
4-
* Copyright 2023 SECO Mind Srl
4+
* Copyright 2025 SECO Mind Srl
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -98,7 +98,8 @@ public AstarteDevice(
9898
deviceId,
9999
credentialSecret,
100100
astarteCryptoStore,
101-
(TimeSpan)(timeOut is null ? TimeSpan.FromSeconds(5) : timeOut));
101+
(TimeSpan)(timeOut is null ? TimeSpan.FromSeconds(5) : timeOut),
102+
ignoreSSLErrors);
102103

103104
astartePropertyStorage = new AstartePropertyStorage(fullCryptoDirPath);
104105

AstarteDeviceSDKCSharpE2E.Tests/Utilities/AstarteDeviceSingleton.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static AstarteDevice Instance
6262
new MockInterfaceProvider(),
6363
astarteMockData.PairingUrl,
6464
cryptoStoreDir,
65-
TimeSpan.FromMilliseconds(500),
65+
TimeSpan.FromMilliseconds(5000),
6666
true
6767
);
6868
astarteDevice.SetAlwaysReconnect(true);

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.7.1] - 2024-02-27
8+
### Fixed
9+
- Skip SSL certificate validation on HTTP requests if `ignoreSSLErrors`
10+
flag is enabled
11+
712
## [0.7.0] - 2024-11-15
813
### Added
914
- Add MQTTNet ManagedClient extension version 4.1.4.563.

0 commit comments

Comments
 (0)