Is MD5 supported on Windows Phone 7? - windows-phone-7

I'm porting some compact framework code that consumes a RESTful service to Windows Phone 7. The REST service requires md5 hashing and method signatures.
This code (which worked on NETCF) no longer compiles and I don't see anything MD5 related in the object browser.
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
buffer = md5.ComputeHash(buffer);
Is md5 not supported on WP7?

A quick googling reveals that some cryptography classes are not supported in any Silverlight versions. One of these is MD5CryptoServiceProvider.
You can use this MD5 implementation for Silverlight on Windows Phone 7.

AES is supported on Phone 7. If you need MD5, you need to look elsewhere.

Related

The type or namespace name 'MD5CryptoServiceProvider' does not exist

I am using the code for generating the MD5 hash in my code ... i do not know why namespace error is given by the compiler. am including the (using System.Security.Cryptography)
Am new to windows phone app development need a little bit help.
System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
Here the error is on MD5CryptoServiceProvider()..
MD5CryptoServiceProvider isn't available in Silverlight.
MSDN : Silverlight System.Security.Cryptography
You have a few choices though.
Use another hash algorithm that Silverlight supports in WP8 (probably the best, since md5 is pretty outdated)
Upgrade to WP8.1 runtime (universal) and use Windows.Security.Cryptography and
Windows.Security.Cryptography.Core
Program your own, it's a pretty simple algorithm. :)
Use someone else implementation.
Jitesh Upadhyay complete MD5 Implementation Windows Phone

Faster alternative to the Windows.Security.Cryptography classes on Windows 8

I am writing a program for Windows 8 that encrypts a lot of data (over 100MB at a time) and have noticed that even when using multi-threading, the encryption APIs on Windows 8 are slower than the Cryptographic Service Providers (CSPs) on previous versions of Windows. I was wondering if there was a faster way to encrypt files using AES on Windows 8.
Microsoft CryptoAPI Next Generation (CNG) is a successor of old CSPs,it's fully native. First implemented in Windows Vista, it is still available in W8.
Why not to use them?
You can try the SecureBlackbox library, it is commercial (with free trial), but implements all the stuff on it's own.
And, anyway, any managed code will be somehow slower than native one.

SHA 256 Algorithm in Power Builder 6.5

I am trying to store the data as secured possible way in database.
For that I am triyng to implement the SHA-256 algorithm in Powerbuilder version 6.5.
This sound old that I am implememting the SHA 256 in PowerBuilder (Desktop Application Development Tool).
Though yet it is outdated we need to implement this secure functionality in PowerBuilder
Because lots of applications are dependant on it.
I Googled for any library for PB 6.5 for SHA256 but didn't get anything.
So please can any one tell me how can I achieve this SHA-256 in PowerBuilder or is there any ready library available fot SHA256 for PB 6.5.
Thanks in Advance.
Have a look at this PB library wich uses the Microsoft Crypto API.
The example is for PB 8+, I've managed to have it running in PB7 by exporting the nvo and windows objects and importing them in a new PB7 library.
According to the MSDN documentation you'll have to use the "Microsoft Enhanced RSA and AES Cryptographic Provider" to be able to calculate the SHA256 hash.

windows CSP api

I am trying to write my own CSP. I am trying to do this by implementing a dll file, but I am not sure if I am on right way.
I found something like this:
Cryptographic Service Provider Developer's Toolkit (CSPDK)
there are samples with CSP API
CPAcquireContext
CPGenKey
... etc.
(it looks for me like an old api or api for winCE)
And here comes my question, which functions should I implement to provide new CSP for windows 7 and XP.
Is my plan good? - should I implement simple DLL and put her reference in register?
Or am i missing something?
You might be missing CNG which is a (long term) replacement for the MS Crypto API. You can create modules for that as well. Unfortunately it is only available since Vista. Windows XP is too old (and you should probably not be producing new applications for XP anyway).
Your HSM vendor will have their CSP written for you. You will get this csp when you install their driver. All you will be required is to access this CSP from your code.
To interface with your HSM vendor's CSP(check what they support), either you should use PKCS#11 or use the cryptoAPI CSP functions.

How use AES/ECB/PKCS7Padding algorithm in Windows Phone 7?

I am new in windows phone development. How can I use AES/ECB/PKCS7Padding algorithm in WP7 ?.
While googled I saw many suggested about Bouncy Castle. But I did not clearly understood about this Bouncy Castle. Is this an algorithm ?.
I need to encrypt/decrypt password for sending to server. In all other phone (Android, iPhone, Blackberry), we use AES/ECB/PKCS7Padding algorithm for this. They all give same ecrypted/decrypt result for our input. But in windows phone I used AesManaged Class for the encryption. But it gives different encrypted result. In the msdn documentation (MSDN documentation) about AESManaged class they said "The cipher mode is always CBC, and the padding mode is always PKCS7". I think maybe thats why here I am getting different encrypted result comparing to other phones.
Is that the problem here ?. If its, then how can I use AES/ECB/PKCS7Padding algorithm in WP7 ?
I dont see any property for setting the cipher mode in AesManaged class.
Thanks.
If you want to use AES/ECB/PKCS7Padding in Windows Phone, you should use Bouncy Castle library.
This library wasn't made exactly for Windows Phone, and you can't use the dll from Bouncy Castle site. Instead, you should download the WP7-ported library from here. (two links at the bottom of the article)
Now, you can use Org.BouncyCastle.Crypto.IBufferedCipher type.
cipher = CipherUtilities.GetCipher("AES/ECB/PKCS7"); // or PKCS7PADDING, no matter
cipher.Init(false, new KeyParameter(key)); // or something else
Then you should work with this variable.
And yes,
"The cipher mode is always CBC, and the padding mode is always PKCS7"
that's why you are getting wrong result.

Resources