Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }