Example #1
0
        /// <summary>
        /// Revokes a <see cref="VirgilCard"/> from Virgil Services.
        /// </summary>
        /// <param name="card">The card to be revoked.</param>
        public async Task RevokeAsync(VirgilCard card)
        {
            if ((this.context == null) || (this.context.Credentials == null) ||
                (this.context.Credentials.GetAppId() == null) ||
                (this.context.Credentials.GetAppKey(context.Crypto) == null))
            {
                throw new AppCredentialsException();
            }
            var revokeRequest = new RevokeCardRequest(card.Id, RevocationReason.Unspecified);

            var appId  = this.context.Credentials.GetAppId();
            var appKey = this.context.Credentials.GetAppKey(this.context.Crypto);


            var fingerprint = this.context.Crypto.CalculateFingerprint(revokeRequest.Snapshot);
            var signature   = this.context.Crypto.Sign(fingerprint.GetValue(), appKey);

            revokeRequest.AppendSignature(appId, signature);

            /* to_ask
             * var requestSigner = new RequestSigner(this.context.Crypto);
             * requestSigner.AuthoritySign(revokeRequest, appId, appKey); */

            await this.context.Client.RevokeCardAsync(revokeRequest);
        }
Example #2
0
        /// <summary>
        /// Revokes a <see cref="VirgilCard"/> from Virgil Services.
        /// </summary>
        /// <param name="card">The card to be revoked.</param>
        public async Task RevokeAsync(VirgilCard card)
        {
            var revokeRequest = new RevokeCardRequest(card.Id, RevocationReason.Unspecified);

            var appId  = this.context.Credentials.GetAppId();
            var appKey = this.context.Credentials.GetAppKey(this.context.Crypto);

            var fingerprint = this.context.Crypto.CalculateFingerprint(revokeRequest.Snapshot);
            var signature   = this.context.Crypto.Sign(fingerprint.GetValue(), appKey);

            revokeRequest.AppendSignature(appId, signature);

            await this.context.Client.RevokeCardAsync(revokeRequest);
        }