Pramod Kangare avatar image
Pramod Kangare asked Phong Vu answered

Ringcentral subscription NotificationEvent Decrypt Method issue

We are impelementing Ringcentral Subscription functionality.

For that We are using code from github url:

We are facing issue in class SubscriptionService.cs:

Below is method where we actually facing issue:

private void OnSubscribe(string result)


var message = JsonConvert.DeserializeObject<string[]>(result)[0];

NotificationEvent?.Invoke(this, new SubscriptionEventArgs(Decrypt(message)));


We dont know what happen in Decrypt(message) function because Debug not going through that code i.e Decrypt(message). message parameter showing encrypted key

Below is Decrypt method:

private object Decrypt(string dataString)


var key = Convert.FromBase64String(subscriptionInfo.DeliveryMode.EncryptionKey);

var keyParameter = ParameterUtilities.CreateKeyParameter("AES", key);

var cipher = CipherUtilities.GetCipher("AES/ECB/PKCS7Padding");

cipher.Init(false, keyParameter);

var data = Convert.FromBase64String(dataString);

var memoryStream = new MemoryStream(data, false);

var cipherStream = new CipherStream(memoryStream, cipher, null);

var bufferSize = 1024;

var buffer = new byte[bufferSize];

var length = 0;

var resultStream = new MemoryStream();

while ((length = cipherStream.Read(buffer, 0, bufferSize)) > 0)


resultStream.Write(buffer, 0, length);


var resultBytes = resultStream.ToArray();

var result = Encoding.UTF8.GetString(resultBytes, 0, resultBytes.Length);

return JsonConvert.DeserializeObject(result);


Please guide us...!!

Thank you..!!

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Phong Vu avatar image
Phong Vu answered

The c-sharp SDK has been deprecated for years and it was mentioned on the repo README file.

Can you port your app to use the latest .Net SDK then let me know if you are still facing the problem.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys