public byte[] DefaultDecrypt(byte[] cipherTextBytes, KeyMaterial64 keyMaterial64, LongRunningOperationContext context = null) { CipherV2 cipherV2 = VisualCrypt2Formatter.DissectVisualCryptBytes(cipherTextBytes, context); var binaryDecryptResponse = BinaryDecrypt(cipherV2, keyMaterial64, context); if (!binaryDecryptResponse.IsSuccess) { throw new Exception(binaryDecryptResponse.Error); } return(binaryDecryptResponse.Result.GetBytes()); }
public Response <CipherV2> BinaryDecodeVisualCrypt(byte[] visualCryptBytes, LongRunningOperationContext context) { var response = new Response <CipherV2>(); try { Guard.NotNull(visualCryptBytes); EnsurePlatform(); context?.CancellationToken.ThrowIfCancellationRequested(); response.Result = VisualCrypt2Formatter.DissectVisualCryptBytes(visualCryptBytes, context); response.SetSuccess(); } catch (Exception e) { response.SetError(e); } return(response); }