Hi. I'm developing simple app for myself, which call rest service in Amazon AWS, parse result and show it on watch. I want to add same encrypted data to headers, on AWS I will validate it and pass request or reject it. Reading documentation I found class, which will be suitable for my, Cipher. Code compile fine, however in runtime it throw exception:
Could not find symbol 'Cipher' Symbol Not Found Error
in line:
var cipher = new Cryptography.Cipher(cipherOptions);
My code with sample data:
using Toybox.Cryptography;
function callRestService() {
var keyConvertOptions = {
:fromRepresentation => StringUtil.REPRESENTATION_STRING_PLAIN_TEXT,
:toRepresentation => StringUtil.REPRESENTATION_BYTE_ARRAY
};
var keyBytes = StringUtil.convertEncodedString("aaaaaaaaaa", keyConvertOptions);
var ivBytes = StringUtil.convertEncodedString("bbbbbbbbbb", keyConvertOptions);
var cipherOptions = {
:algorithm => Cryptography.CIPHER_AES256,
:mode => Cryptography.MODE_CBC,
:key => keyBytes,
:iv => ivBytes
};
var cipher = new Cryptography.Cipher(cipherOptions);
var encryptedBytes = cipher.encrypt("token");
var encryptedToken = encryptedBytes.toString();
...
}
I'm using Connect IQ 3.0.10, SDK 3.0.11, Eclipse IDE 2019-03.