在我的Windows phone7应用程序中,我放置了一个画布,并将其背景颜色设置为一些十六进制颜色代码.现在我无法通过c#代码获取十六进制颜色代码值.我使用下面的代码,但它给出了系统中的颜色值. windows.media.brush.Plz帮我解答?
clr = Convert.ToString(clr1.Background);
Run Code Online (Sandbox Code Playgroud) 我尝试在 C# 中解密的数据在 Nodejs 中使用 AES-256 算法进行加密,代码如下。
const crypto = require('crypto');
const validator = require('validator');
const algorithm = 'aes256';
const inputEncoding = 'utf8';
const outputEncoding = 'hex';
const iv = crypto.randomBytes(16)
function encrypt(key,text) {
key = processKey(key);
let cipher = crypto.createCipheriv(algorithm, key, iv);
let ciphered = cipher.update(text, inputEncoding, outputEncoding);
ciphered += cipher.final(outputEncoding);
return ciphered;
}
Run Code Online (Sandbox Code Playgroud)
现在,我获得了长度为 32 的加密数据(如“1234567304e07a5d2e93fbeefd0e417e”)和长度为 32 的密钥(如“123456673959499f9d37623168b2c977”)。
我尝试使用下面的 C# 代码解密相同的内容,但收到错误“要解密的数据长度无效”。请提供建议。
public static string Decrypt(string combinedString, string keyString)
{
string plainText;
byte[] combinedData = StringToByteArray(combinedString);
Aes aes = …Run Code Online (Sandbox Code Playgroud)