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 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); }
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); }
public Response <CipherV2> DecodeVisualCrypt(string visualCryptText, LongRunningOperationContext context) // should the parameter type be VisualCryptText? { var response = new Response <CipherV2>(); try { Guard.NotNull(visualCryptText); EnsurePlatform(); response.Result = VisualCrypt2Formatter.DissectVisualCryptText(visualCryptText, context); response.SetSuccess(); } catch (Exception e) { response.SetError(e); } return(response); }
public Response <VisualCryptText> EncodeVisualCrypt(CipherV2 cipherV2) { var response = new Response <VisualCryptText>(); try { Guard.NotNull(cipherV2); EnsurePlatform(); response.Result = VisualCrypt2Formatter.CreateVisualCryptText(cipherV2); response.SetSuccess(); } catch (Exception e) { response.SetError(e); } return(response); }