public byte[] DefaultEncrypt(byte[] plaintextBytes, KeyMaterial64 keyMaterial64) { var binaryEncryptResponse = BinaryEncrypt(new Clearbytes(plaintextBytes), keyMaterial64, new RoundsExponent(RoundsExponent.DontMakeRounds), null); if (binaryEncryptResponse.IsSuccess) { return(VisualCrypt2Formatter.CreateBinary(binaryEncryptResponse.Result)); } throw new Exception(binaryEncryptResponse.Error); }
public Response <byte[]> BinaryEncodeVisualCrypt(CipherV2 cipherV2, LongRunningOperationContext context) { var response = new Response <byte[]>(); try { Guard.NotNull(cipherV2); EnsurePlatform(); context?.CancellationToken.ThrowIfCancellationRequested(); response.Result = VisualCrypt2Formatter.CreateBinary(cipherV2); response.SetSuccess(); } catch (Exception e) { response.SetError(e); } return(response); }