public EAclWithSignature GetEAclWithSignature(CancellationToken context, ContainerID cid, CallOptions options = null)
        {
            var container_client = new ContainerService.ContainerServiceClient(channel);
            var opts             = DefaultCallOptions.ApplyCustomOptions(options);
            var req = new GetExtendedACLRequest
            {
                Body = new GetExtendedACLRequest.Types.Body
                {
                    ContainerId = cid
                }
            };

            req.MetaHeader = opts.GetRequestMetaHeader();
            req.SignRequest(key);

            var resp = container_client.GetExtendedACL(req, cancellationToken: context);

            if (!resp.VerifyResponse())
            {
                throw new InvalidOperationException("invalid container put response");
            }
            var eacl = resp.Body.Eacl;
            var sig  = resp.Body.Signature;

            if (!eacl.VerifyMessagePart(sig))
            {
                throw new InvalidOperationException("invalid eacl");
            }
            return(new EAclWithSignature
            {
                Table = eacl,
                Signature = sig,
            });
        }
Beispiel #2
0
        public async Task <EAclWithSignature> GetEAcl(GetExtendedACLRequest request, DateTime?deadline = null, CancellationToken context = default)
        {
            var resp = await ContainerClient.GetExtendedACLAsync(request, deadline : deadline, cancellationToken : context);

            if (!resp.Verify())
            {
                throw new InvalidOperationException("invalid get eacl response");
            }
            CheckStatus(resp);
            if (!resp.Body.Signature.VerifyRFC6979(resp.Body.Eacl))
            {
                throw new InvalidOperationException("invalid eacl signature");
            }
            return(new EAclWithSignature
            {
                Table = resp.Body.Eacl,
                Signature = resp.Body.Signature,
                SessionToken = resp.Body.SessionToken
            });
        }
Beispiel #3
0
        public async Task <EAclWithSignature> GetEAcl(ContainerID cid, CallOptions options = null, CancellationToken context = default)
        {
            if (cid is null)
            {
                throw new ArgumentNullException(nameof(cid));
            }
            var opts = DefaultCallOptions.ApplyCustomOptions(options);

            CheckOptions(opts);
            var req = new GetExtendedACLRequest
            {
                Body = new GetExtendedACLRequest.Types.Body
                {
                    ContainerId = cid
                }
            };

            req.MetaHeader = opts.GetRequestMetaHeader();
            opts.Key.Sign(req);

            return(await GetEAcl(req, opts.Deadline, context));
        }