コード例 #1
0
        private RsaPrivateCrtKeyParameters GetPrivateKey()
        {
            using var privateKeyReader = privateKeySource.GetPrivateKeyReader();
            var pemReader = new PemReader(privateKeyReader);
            var keyPair   = (AsymmetricCipherKeyPair)pemReader.ReadObject();

            return((RsaPrivateCrtKeyParameters)keyPair.Private);
        }
コード例 #2
0
        /// <inheritdoc />
        public string GetToken(int expirationSeconds = 600)
        {
            var readToEnd = _privateKeySource.GetPrivateKeyReader().ReadToEnd();

            var generator = new GitHubJwtFactory(
                _privateKeySource,
                new GitHubJwtFactoryOptions
            {
                AppIntegrationId  = _appIntegrationId,
                ExpirationSeconds = expirationSeconds
            }
                );

            return(generator.CreateEncodedJwtToken());
        }