示例#1
0
        public Task <CertificateSignResponse> CertificateSign(string sessionToken, RSACryptoServiceProvider rsa, TimeSpan duration)
        {
            RSAParameters keyInfo = rsa.ExportParameters(false);

            string n = BinaryHelper.BigIntegerFromBigEndian(keyInfo.Modulus).ToString();
            string e = BinaryHelper.BigIntegerFromBigEndian(keyInfo.Exponent).ToString();

            CertificateSignRequest signRequest = new CertificateSignRequest();

            signRequest.PublicKey = new PublicKey()
            {
                Algorithm = "RS", E = e, N = n
            };
            signRequest.Duration = (long)duration.TotalMilliseconds;

            return(Post <CertificateSignRequest, CertificateSignResponse>("certificate/sign", signRequest, sessionToken, "sessionToken", 2 * 32));
        }