Esempio n. 1
0
        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());
        }
Esempio n. 2
0
        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);
        }