Fix DPP string conversion to hex

DppManager#encodeStringToHex converts the string to a char[] before
converting into a hex string. However, since Java chars are represented
in UTF-16, then the hex string will represent the UTF-16 encoding of the
string. Generally this results in no difference for ASCII characters,
but CJK characters use 3-bytes for UTF-8 and 2-bytes for UTF-16,
resulting in an incorrect hex string.

Since we expect the quoted SSID/passphrases passed through DPP to be in
UTF-8, then we need to convert the string using the values in getBytes()
instead, which returns the correct UTF-8 encoding.

Bug: 291166388
Test: atest DppManagerTest
Change-Id: I15563fa5a92fccb2dadac86f239ec1c356ec531b
2 files changed