Avatar of John Rugo
John Rugo
Flag for United States of America asked on

Encryption after converting from 4.8 Framework to .NET 6.0

Hi All,

I converted a .net framework 4.8 c# project to .NET 6.0.

First issue I have run into is that my Rijndael encryption is broken.  The two lines below are an issue.  Is there another assembly or method(s) I should be using now?

 System.Security.Cryptography.RijndaelManaged AES = new System.Security.Cryptography.RijndaelManaged();
            System.Security.Cryptography.SHA256 SHA256 = new System.Security.Cryptography.SHA256();

Open in new window

Encryption.NET ProgrammingC#

Avatar of undefined
Last Comment
Éric Moreau

8/22/2022 - Mon
Éric Moreau

Did you check if you are still having a reference to System.Security.Cryptography? as per RijndaelManaged Class (System.Security.Cryptography) | Microsoft Docs , it is still supported

is broken....  What error message?
John Rugo

So, the first line is indicating that RijndaelManaged types are obsolete and to use Aes instead. I did make that change to but get the same error as the second line. The second line "new System.Security.Cryptography.SHA256();" errors with "Cannot create an instance of the abstract type or interface 'SHA256'.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
John Rugo

Additionally I change the first line to below without an error; but did not change the error of the second line.
System.Security.Cryptography.AesCng AES = new System.Security.Cryptography.AesCng();

Open in new window

Éric Moreau

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question