Skip to content

Commit 43a3e47

Browse files
fix/JSON Serialisation when message decryption failed (#202)
* fix: JSON Serialisation when message decryption failed * PubNub SDK v6.19.5.0 release. --------- Co-authored-by: PubNub Release Bot <[email protected]>
1 parent 9ac0db5 commit 43a3e47

File tree

9 files changed

+32
-28
lines changed

9 files changed

+32
-28
lines changed

.pubnub.yml

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
name: c-sharp
2-
version: "6.19.4"
2+
version: "6.19.5"
33
schema: 1
44
scm: github.com/pubnub/c-sharp
55
changelog:
6+
- date: 2024-01-17
7+
version: v6.19.5
8+
changes:
9+
- type: bug
10+
text: "Fixes issue of getting exception for custom objects in subscription and history when crypto module is configured."
611
- date: 2023-11-28
712
version: v6.19.4
813
changes:
@@ -761,7 +766,7 @@ features:
761766
- QUERY-PARAM
762767
supported-platforms:
763768
-
764-
version: Pubnub 'C#' 6.19.4
769+
version: Pubnub 'C#' 6.19.5
765770
platforms:
766771
- Windows 10 and up
767772
- Windows Server 2008 and up
@@ -771,7 +776,7 @@ supported-platforms:
771776
- .Net Framework 4.5
772777
- .Net Framework 4.6.1+
773778
-
774-
version: PubnubPCL 'C#' 6.19.4
779+
version: PubnubPCL 'C#' 6.19.5
775780
platforms:
776781
- Xamarin.Android
777782
- Xamarin.iOS
@@ -791,7 +796,7 @@ supported-platforms:
791796
- .Net Core
792797
- .Net 6.0
793798
-
794-
version: PubnubUWP 'C#' 6.19.4
799+
version: PubnubUWP 'C#' 6.19.5
795800
platforms:
796801
- Windows Phone 10
797802
- Universal Windows Apps
@@ -815,7 +820,7 @@ sdks:
815820
distribution-type: source
816821
distribution-repository: GitHub
817822
package-name: Pubnub
818-
location: https://github.com/pubnub/c-sharp/releases/tag/v6.19.4.0
823+
location: https://github.com/pubnub/c-sharp/releases/tag/v6.19.5.0
819824
requires:
820825
-
821826
name: ".Net"
@@ -1098,7 +1103,7 @@ sdks:
10981103
distribution-type: source
10991104
distribution-repository: GitHub
11001105
package-name: PubNubPCL
1101-
location: https://github.com/pubnub/c-sharp/releases/tag/v6.19.4.0
1106+
location: https://github.com/pubnub/c-sharp/releases/tag/v6.19.5.0
11021107
requires:
11031108
-
11041109
name: ".Net Core"
@@ -1457,7 +1462,7 @@ sdks:
14571462
distribution-type: source
14581463
distribution-repository: GitHub
14591464
package-name: PubnubUWP
1460-
location: https://github.com/pubnub/c-sharp/releases/tag/v6.19.4.0
1465+
location: https://github.com/pubnub/c-sharp/releases/tag/v6.19.5.0
14611466
requires:
14621467
-
14631468
name: "Universal Windows Platform Development"

CHANGELOG

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
v6.19.5 - January 17 2024
2+
-----------------------------
3+
- Fixed: fixes issue of getting exception for custom objects in subscription and history when crypto module is configured.
4+
15
v6.19.4 - November 28 2023
26
-----------------------------
37
- Fixed: handle unencrypted message while getting messages with crypto.

src/Api/PubnubApi/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
[assembly: AssemblyProduct("Pubnub C# SDK")]
1212
[assembly: AssemblyCopyright("Copyright © 2021")]
1313
[assembly: AssemblyTrademark("")]
14-
[assembly: AssemblyVersion("6.19.4.0")]
15-
[assembly: AssemblyFileVersion("6.19.4.0")]
14+
[assembly: AssemblyVersion("6.19.5.0")]
15+
[assembly: AssemblyFileVersion("6.19.5.0")]
1616
// Setting ComVisible to false makes the types in this assembly not visible
1717
// to COM components. If you need to access a type in this assembly from
1818
// COM, set the ComVisible attribute to true on that type.

src/Api/PubnubApi/PubnubApi.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515
<PropertyGroup>
1616
<PackageId>Pubnub</PackageId>
17-
<PackageVersion>6.19.4.0</PackageVersion>
17+
<PackageVersion>6.19.5.0</PackageVersion>
1818
<Title>PubNub C# .NET - Web Data Push API</Title>
1919
<Authors>Pandu Masabathula</Authors>
2020
<Owners>PubNub</Owners>
2121
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
2222
<PackageIconUrl>http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png</PackageIconUrl>
2323
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
2424
<RepositoryUrl>https://github.com/pubnub/c-sharp/</RepositoryUrl>
25-
<PackageReleaseNotes>Handle unencrypted message while getting messages with crypto.</PackageReleaseNotes>
25+
<PackageReleaseNotes>Fixes issue of getting exception for custom objects in subscription and history when crypto module is configured.</PackageReleaseNotes>
2626
<PackageTags>Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing</PackageTags>
2727
<!--<Summary>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Summary>-->
2828
<Description>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Description>

src/Api/PubnubApi/PubnubCoreBase.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -736,8 +736,7 @@ private void ResponseToUserCallback<T>(List<object> result, PNOperationType type
736736
currentConfig.LogVerbosity
737737
);
738738
}
739-
object decodeMessage = jsonLib.DeserializeToObject((decryptMessage == "**DECRYPT ERROR**") ? payload.ToString() : decryptMessage);
740-
739+
object decodeMessage = jsonLib.DeserializeToObject((decryptMessage == "**DECRYPT ERROR**") ? jsonLib.SerializeToJsonString(payload) : decryptMessage);
741740
payloadContainer.Add(decodeMessage);
742741
}
743742
else

src/Api/PubnubApi/Security/SecureMessage.cs

+6-10
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,10 @@ public List<object> HistoryDecodeDecryptLoop<T>(PNOperationType type, List<objec
6868
{
6969
status.AffectedChannelGroups.AddRange(channelGroups);
7070
}
71-
72-
errorCallback.OnResponse(default(T), status);
71+
pubnubLog.WriteToLog("Failed to decrypt message!\nMessage might be not encrypted, returning as is...");
7372
}
74-
pubnubLog.WriteToLog("Failed to decrypt message!\nMessage might be not encrypted, returning as is...");
75-
object decodeMessage = jsonLib.DeserializeToObject((decryptMessage == "**DECRYPT ERROR**") ? element.ToString() : decryptMessage);
76-
receivedMsg.Add(decodeMessage);
73+
object decodedMessage = jsonLib.DeserializeToObject((decryptMessage == "**DECRYPT ERROR**") ? jsonLib.SerializeToJsonString(element) : decryptMessage);
74+
receivedMsg.Add(decodedMessage);
7775
}
7876
returnMessage.Add(receivedMsg);
7977
}
@@ -151,13 +149,11 @@ public List<object> FetchHistoryDecodeDecryptLoop<T>(PNOperationType type, Dicti
151149
{
152150
status.AffectedChannelGroups.AddRange(channelGroups);
153151
}
154-
155-
errorCallback.OnResponse(default(T), status);
152+
pubnubLog.WriteToLog("Failed to decrypt message!\nMessage might be not encrypted, returning as is...");
156153
#endregion
157154
}
158-
pubnubLog.WriteToLog("Failed to decrypt message!\nMessage might be not encrypted, returning as is...");
159-
object decodeMessage = jsonLib.DeserializeToObject((decryptMessage == "**DECRYPT ERROR**") ? decryptMessage : decryptMessage);
160-
dicDecrypt.Add(kvpValue.Key, decodeMessage);
155+
object decodedMessage = jsonLib.DeserializeToObject((decryptMessage == "**DECRYPT ERROR**") ? jsonLib.SerializeToJsonString(kvpValue.Value) : decryptMessage);
156+
dicDecrypt.Add(kvpValue.Key, decodedMessage);
161157
}
162158
else
163159
{

src/Api/PubnubApiPCL/PubnubApiPCL.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515

1616
<PropertyGroup>
1717
<PackageId>PubnubPCL</PackageId>
18-
<PackageVersion>6.19.4.0</PackageVersion>
18+
<PackageVersion>6.19.5.0</PackageVersion>
1919
<Title>PubNub C# .NET - Web Data Push API</Title>
2020
<Authors>Pandu Masabathula</Authors>
2121
<Owners>PubNub</Owners>
2222
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
2323
<PackageIconUrl>http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png</PackageIconUrl>
2424
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
2525
<RepositoryUrl>https://github.com/pubnub/c-sharp/</RepositoryUrl>
26-
<PackageReleaseNotes>Handle unencrypted message while getting messages with crypto.</PackageReleaseNotes>
26+
<PackageReleaseNotes>Fixes issue of getting exception for custom objects in subscription and history when crypto module is configured.</PackageReleaseNotes>
2727
<PackageTags>Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing</PackageTags>
2828
<!--<Summary>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Summary>-->
2929
<Description>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Description>

src/Api/PubnubApiUWP/PubnubApiUWP.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616

1717
<PropertyGroup>
1818
<PackageId>PubnubUWP</PackageId>
19-
<PackageVersion>6.19.4.0</PackageVersion>
19+
<PackageVersion>6.19.5.0</PackageVersion>
2020
<Title>PubNub C# .NET - Web Data Push API</Title>
2121
<Authors>Pandu Masabathula</Authors>
2222
<Owners>PubNub</Owners>
2323
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
2424
<PackageIconUrl>http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png</PackageIconUrl>
2525
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
2626
<RepositoryUrl>https://github.com/pubnub/c-sharp/</RepositoryUrl>
27-
<PackageReleaseNotes>Handle unencrypted message while getting messages with crypto.</PackageReleaseNotes>
27+
<PackageReleaseNotes>Fixes issue of getting exception for custom objects in subscription and history when crypto module is configured.</PackageReleaseNotes>
2828
<PackageTags>Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing</PackageTags>
2929
<!--<Summary>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Summary>-->
3030
<Description>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Description>

src/Api/PubnubApiUnity/PubnubApiUnity.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<PropertyGroup>
1717
<PackageId>PubnubApiUnity</PackageId>
18-
<PackageVersion>6.19.4.0</PackageVersion>
18+
<PackageVersion>6.19.5.0</PackageVersion>
1919
<Title>PubNub C# .NET - Web Data Push API</Title>
2020
<Authors>Pandu Masabathula</Authors>
2121
<Owners>PubNub</Owners>

0 commit comments

Comments
 (0)