Ich versuche, in einer Logik-App-Standard-Inline-C#-Aktion zu entschlüsseln, aber der Code, der in einer Funktions-App einwandfrei funktioniert, fällt in logischen Apps fehl. < /p>
Problem
< /code>
Der AES-Schlüssel wird in einem Azure-Taste als Basis 64-kodierter String
gespeichert (32 Byte → aes-256). Verschlüsselte Nutzlast.InvokeFunctionFailed
The function 'CSharp_wf-infringement-process-transaction_execute_csharp_script_code.csx'
failed with the error 'Exception binding parameter 'context'' when executing.
Please verify function code is valid.
< /code>
Inline C# Code im logischen App -Standard < /p>
// Add the required libraries
#r "Newtonsoft.Json"
#r "Microsoft.Azure.Workflows.Scripting"
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Microsoft.Azure.Workflows.Scripting;
using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
public static async Task Run(WorkflowContext context, ILogger log)
{
var composeOutput = (await context.GetActionResults("Compose").ConfigureAwait(false)).Outputs;
string KeyStringStr = composeOutput["KeyString"].ToString();
string Base64DataStr = composeOutput["Base64Data"].ToString();
if (string.IsNullOrEmpty(KeyStringStr))
throw new ArgumentException("AES key is missing.");
if (string.IsNullOrEmpty(Base64DataStr))
throw new ArgumentException("Ciphertext is missing.");
byte[] key = Convert.FromBase64String(KeyStringStr);
byte[] allBytes = Convert.FromBase64String(Base64DataStr);
byte[] iv = allBytes.Take(16).ToArray();
byte[] cipherBytes = allBytes.Skip(16).ToArray();
string decryptedText;
using (var aes = Aes.Create())
{
aes.Key = key;
aes.IV = iv;
aes.Mode = CipherMode.CBC;
aes.Padding = PaddingMode.PKCS7;
using var ms = new MemoryStream();
using (var cryptoStream = new CryptoStream(ms, aes.CreateDecryptor(), CryptoStreamMode.Write))
{
cryptoStream.Write(cipherBytes, 0, cipherBytes.Length);
cryptoStream.FlushFinalBlock();
}
decryptedText = Encoding.UTF8.GetString(ms.ToArray());
}
return new { DecryptedText = decryptedText };
}
public class Results
{
public string DecryptedText { get; set; }
}
Ich versuche, in einer Logik-App-Standard-Inline-C#-Aktion zu entschlüsseln, aber der Code, der in einer Funktions-App einwandfrei funktioniert, fällt in logischen Apps fehl. < /p> [code]Problem < /code>
Der AES-Schlüssel wird in einem Azure-Taste als Basis 64-kodierter String gespeichert (32 Byte → aes-256). Verschlüsselte Nutzlast.InvokeFunctionFailed The function 'CSharp_wf-infringement-process-transaction_execute_csharp_script_code.csx' failed with the error 'Exception binding parameter 'context'' when executing. Please verify function code is valid. < /code> Inline C# Code im logischen App -Standard < /p> // Add the required libraries #r "Newtonsoft.Json" #r "Microsoft.Azure.Workflows.Scripting"
using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Primitives; using Microsoft.Azure.Workflows.Scripting; using Newtonsoft.Json.Linq; using System; using System.IO; using System.Security.Cryptography; using System.Text;
public static async Task Run(WorkflowContext context, ILogger log) { var composeOutput = (await context.GetActionResults("Compose").ConfigureAwait(false)).Outputs;
if (string.IsNullOrEmpty(KeyStringStr)) throw new ArgumentException("AES key is missing."); if (string.IsNullOrEmpty(Base64DataStr)) throw new ArgumentException("Ciphertext is missing.");
using var ms = new MemoryStream(); using (var cryptoStream = new CryptoStream(ms, aes.CreateDecryptor(), CryptoStreamMode.Write)) { cryptoStream.Write(cipherBytes, 0, cipherBytes.Length); cryptoStream.FlushFinalBlock(); } decryptedText = Encoding.UTF8.GetString(ms.ToArray()); }
return new { DecryptedText = decryptedText }; }
public class Results { public string DecryptedText { get; set; } } [/code]
Ich kann nicht feststellen, was die Ursache für die ausgelöste Ausnahme ist („ungültige Füllbytes“). Beim Versuch, Beispiele für das gleiche Problem zu finden, scheint dies hauptsächlich auf die...
Mit AES in C# habe ich zwei statische Methoden zur Verschlüsselung und Entschlüsselung geschrieben.
Verschlüsseln:
static byte[] Encrypt(byte[] plaintext, byte[] Key, byte[] IV)
{
byte[]...
Ich versuche, mit PyCrypto zwei Funktionen zu erstellen, die zwei Parameter akzeptieren: die Nachricht und den Schlüssel, und dann die Nachricht ver-/entschlüsseln.
Ich habe im Internet mehrere Links...
Ich habe eine JSON -Datei erhalten, die mit Golang AES/GCM/Nopadding verschlüsselt wurde, und ich habe AES/GCM/Nopadding mit Java implementiert. Ich kann die JSON -Datei verschlüsseln und sie...
Erklärung.
Ich habe ein Problem mit der AES-256-CTR-Entschlüsselung mithilfe der React-native-aes-crypto-Bibliothek. Die Entschlüsselung funktioniert auf Android einwandfrei, schlägt jedoch auf iOS...