public byte[] DefaultEncrypt(byte[] plaintextBytes, KeyMaterial64 keyMaterial64) { var binaryEncryptResponse = BinaryEncrypt(new Clearbytes(plaintextBytes), keyMaterial64, new RoundsExponent(RoundsExponent.DontMakeRounds), null); if (binaryEncryptResponse.IsSuccess) { return(XDSSecFormatter.CreateBinary(binaryEncryptResponse.Result)); } throw new Exception(binaryEncryptResponse.Error); }
public byte[] DefaultDecrypt(byte[] cipherTextBytes, KeyMaterial64 keyMaterial64, LongRunningOperationContext context = null) { CipherV2 cipherV2 = XDSSecFormatter.DissectXDSSecBytes(cipherTextBytes, context); var binaryDecryptResponse = BinaryDecrypt(cipherV2, keyMaterial64, context); if (!binaryDecryptResponse.IsSuccess) { throw new Exception(binaryDecryptResponse.Error); } return(binaryDecryptResponse.Result.GetBytes()); }
public Response <CipherV2> BinaryDecodeXDSSec(byte[] xdsSecBytes, LongRunningOperationContext context) { var response = new Response <CipherV2>(); try { Guard.NotNull(xdsSecBytes); EnsurePlatform(); context?.CancellationToken.ThrowIfCancellationRequested(); response.Result = XDSSecFormatter.DissectXDSSecBytes(xdsSecBytes, context); response.SetSuccess(); } catch (Exception e) { response.SetError(e); } return(response); }
public Response <byte[]> BinaryEncodeXDSSec(CipherV2 cipherV2, LongRunningOperationContext context) { var response = new Response <byte[]>(); try { Guard.NotNull(cipherV2); EnsurePlatform(); context?.CancellationToken.ThrowIfCancellationRequested(); response.Result = XDSSecFormatter.CreateBinary(cipherV2); response.SetSuccess(); } catch (Exception e) { response.SetError(e); } return(response); }
public Response <CipherV2> DecodeXDSSec(string xdsSecText, LongRunningOperationContext context) // should the parameter type be XDSSecText? { var response = new Response <CipherV2>(); try { Guard.NotNull(xdsSecText); EnsurePlatform(); response.Result = XDSSecFormatter.DissectXDSSecText(xdsSecText, context); response.SetSuccess(); } catch (Exception e) { response.SetError(e); } return(response); }
public Response <XDSSecText> EncodeXDSSec(CipherV2 cipherV2) { var response = new Response <XDSSecText>(); try { Guard.NotNull(cipherV2); EnsurePlatform(); response.Result = XDSSecFormatter.CreateXDSSecText(cipherV2); response.SetSuccess(); } catch (Exception e) { response.SetError(e); } return(response); }