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.
Related
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
In Windows 8/8.1 it's now possible to enable/disable Bluetooth via the OS itself (see image below). This is awesome because it's device/driver-agnostic.
On Android, this is possible via BluetoothAdapter.enable() and BluetoothAdapter.disable(), but I haven't been able to find anything to do this on Windows (even though it seems like it's definitely possible).
So I've tried using:
BluetoothEnableIncomingConnections() - However, this only prevents new incoming connections. It doesn't disable existing ones.
devcon.exe - The problem with this method is that A. it is a non-redistributable binary B. it requires that you know he device ID ahead of time (so it's not device/driver-agnostic). Also, while it's not a dealbreaker, it'd be nice to not require elevation.
UI Automation - Simply launching the PC Settings app and toggling the switch with keyboard events is easy, but it's super ugly, both in terms of proper coding practices and in terms of user experience. That being said, this is the only way I've found to achieve the behavior I'm looking for so far.
I'm writing a native Win32 app in C++, so I'm not constrained to any Windows Store app requirements, although, it would be great if there was an approach that didn't require elevation.
TL;DR
Are there any APIs, WMI interfaces, or anything else available to achieve functionally equivalent results to flipping the Bluetooth toggle switch? If not, are there any alternative methods which yield similar results?
In win8.1 you should be able to call BluetoothEnableRadio to enable/disable the local radio.
Basically the manufacturers should include a method to accomplish this so you don't have to load a dll.
"Beginning with Windows 8.1 vendors are no longer required to implement radio on/off capability (for Bluetooth 4.0 radios) in a software DLL as described in this topic, because the operating system now handles this functionality. Windows 8.1 will ignore any such DLL, even if present."
check out this link which talks about it:
http://msdn.microsoft.com/en-us/library/windows/hardware/hh450832%28v=vs.85%29.aspx
I am using SystemState.phonesignalStrength property to fetch signal strength in my Windows Mobile Application 6.5(C#) for HTC HD 8585,
Problem With this property is that it always gives 100 value as signalstrength even if there is no sim in phone or phone is in Airplane Mode.
I my very confused what is happening.
Any Idea ,How Can i use it to fetch correct signal strength?
You can P/Invoke the RIL API function RIL_GetSignalQuality.
Alternatively, you can P/Invoke the State and Notification Broker API and monitor the SN_PHONESIGNALSTRENGTH* registry key defined in snapi.h.
I don't believe Microsoft provides access to either of these things through the Compact Framework, but there may be 3rd party libraries that do the P/Invoking for you. OpenNetCF is a good place to start.
Both of these things are, however, OEM support dependent. (Microsoft provides the interface, the OEM must implement it.)
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.
I need to scan Wifi access point on Windows Mobile and connect the one of scanned results.
Currently I am using C# language, Windows Mobile 6.5 device, also to scan I am using the below code.
[DllImport(wlanapi.dll", SetLastError=true)]
I am using wlanapi.dll, but it seems that not possible to use on Mobile.
Does anyone know about the belows.
Could I use the dll in Windows Mobile 6.5 to scan and connect?
If the 1 is not possible, please let me know the different methods..
Please give me the clues.
wlanapi.dll doesn't exist in WinMo/WinCE. You have to use an API that is supported.
Most WinMo WiFi drivers (though probably not all) support the Wireless Zero Config (WZC) set of APIs. The native versions of these APIs, like WZCQueryInterface, are outlined in MSDN.
Microsoft does not provide any managed interface for these APIs, in fact the native documentation for them is pretty bad too. The definitive "example" of it's use is in the NETUI component source of Platform Builder. Gettign the eval version just for the source is very worthwhile if you plan to do much WinCE/WinMo development.
From a managed perspective I wrote an MSDN article back in '06 that talks about using the SDF for getting network info. The SDF has been reworked a lot since then, especially in the WZC area, but it's still pretty similar.
I did an updated blog post in '07 about custom-drawn ListBoxes, and while that's not what you're after, the data being displayed is wireless network info, which is in line with what you're after.