News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Ringcentral subscription NotificationEvent Decrypt Method issue
Tags: sdk
Jan 15, 2020 at 11:11pm   •   1 replies  •  0 likes
Pramod Kangare

We are impelementing Ringcentral Subscription functionality.

For that We are using code from github url:

https://github.com/ringcentral/ringcentral-csharp/tree/master/RingCentral/Subscription

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 Answer
answered on Jan 16, 2020 at 8:56am  

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.


 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us