I have done very little with .Net so far and had a requirement to do some cryptography stuff. Apart from being pretty nightmarish with regards to slinging datatypes around my code works fine on 11.7.1. However with 11.6.3 it does not even compile:
Could not find class or interface System.Security.Cryptography.SHA512CryptoServiceProvider. (12886)
The following code compiles without any extra assembly references on 11.7.1. 11.6.3 has no problems with the SHA1, but refuses to find the SHA512:
def var oSha1 as class System.Security.Cryptography.SHA1CryptoServiceProvider.def var oSha512 as class System.Security.Cryptography.SHA512CryptoServiceProvider.
Based on knowledgebase.progress.com/.../000054406:
And based on https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.sha512cryptoserviceprovider.-ctor?view=netframework-4.0 - the SHA512 class has been available since .Net 2.0
What am I missing?
The only thing I can think is that Microsoft moved where this class is implemented, i.e., what assembly it's in between 4.0 and 4.6, and didn't tell anybody! I tried making an assemblies.xml file in 11.6, and even with both of these in the .xml file...:
<assembly name="netstandard, Version=188.8.131.52, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" />
<assembly name="System.Security.Cryptography.Csp, Version=184.108.40.206, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
... it does not work. These are the assemblies listed in the Microsoft doc. So this is indeed mysterious. Sorry, I cannot provide anything more helpful.
Thanks for looking.
"Interestingly" the SHA512 and SHA512Managed classes both can be found (and compile) whereas SHA512Cng and SHA512CrytpoServiceProvider both cannot be found.
I seem to be able to replace the SHA512CryptoServiceProvider with the SHA512Managed class and everything works. I was given a C# source that was using the SHA512CryptoServiceProvider.
Based on social.msdn.microsoft.com/.../managed-vs-nonmanaged-hashing-algorythms-sha512-vs-sha512managed I am going to guess that SHA512CryptoServiceProvider performs better than SHA512Managed - I am going to bet that that performance gain has already been completely blown on the hours spent figuring out why it wasn't working :-)
And just as an addition this is how I'm checking a file against it's signature using the public key:
def var rsa as class System.Security.Cryptography.RSACryptoServiceProvider no-undo.
rsa = NEW System.Security.Cryptography.RSACryptoServiceProvider().
rsa:FromXmlString( lcpublic_key ).
rawToByteArray( message-digest( "SHA-512", base64-decode( lcfile ) ) ),
// new System.Security.Cryptography.SHA512CryptoServiceProvider(),
memptrToByteArray( base64-decode( lcsignature ) )