コード例 #1
0
        /// <summary>
        /// Sign the specfiied data
        /// </summary>
        public byte[] SignData(byte[] data, string keyId = null)
        {
            var credentials = SecurityUtils.CreateSigningCredentials(keyId);

            using (var signatureProvider = new SignatureProviderFactory().CreateForSigning(credentials.SigningKey, credentials.SignatureAlgorithm))
                return(signatureProvider.Sign(data));
        }
コード例 #2
0
        /// <summary>
        /// Sign the specfiied data
        /// </summary>
        public byte[] SignData(byte[] data, string keyId = null)
        {
            var credentials = SecurityUtils.CreateSigningCredentials(keyId);

            if (credentials == null)
            {
                throw new InvalidOperationException($"Couldn't create signature for key {keyId}");
            }
            using (var signatureProvider = new SignatureProviderFactory().CreateForSigning(credentials.SigningKey, credentials.SignatureAlgorithm))
                return(signatureProvider.Sign(data));
        }