示例#1
0
        public SharedContext()
        {
            var serializedRsa = string.Empty;

            using (var provider = new RSACryptoServiceProvider())
            {
                serializedRsa = provider.ToXmlString(true);
            }

            SignatureKey = new JsonWebKey
            {
                Alg    = AllAlg.RS256,
                KeyOps = new KeyOperations[]
                {
                    KeyOperations.Sign,
                    KeyOperations.Verify
                },
                Kid           = "11",
                Kty           = KeyType.RSA,
                Use           = Use.Sig,
                SerializedKey = serializedRsa,
            };
            ModelSignatureKey = new EF.Models.JsonWebKey
            {
                Alg           = EF.Models.AllAlg.RS256,
                KeyOps        = "2,3",
                Kid           = "11",
                Kty           = EF.Models.KeyType.RSA,
                Use           = EF.Models.Use.Sig,
                SerializedKey = serializedRsa,
            };
            EncryptionKey = new JsonWebKey
            {
                Alg    = AllAlg.RSA1_5,
                KeyOps = new[]
                {
                    KeyOperations.Decrypt,
                    KeyOperations.Encrypt
                },
                Kid           = "10",
                Kty           = KeyType.RSA,
                Use           = Use.Enc,
                SerializedKey = serializedRsa,
            };
            ModelEncryptionKey = new EF.Models.JsonWebKey
            {
                Alg           = EF.Models.AllAlg.RSA1_5,
                KeyOps        = "2,3",
                Kid           = "10",
                Kty           = EF.Models.KeyType.RSA,
                Use           = EF.Models.Use.Enc,
                SerializedKey = serializedRsa,
            };
            HttpClientFactory = new FakeHttpClientFactory();
        }
        public SharedContext()
        {
            var serializedRsa = string.Empty;

            using (var provider = new RSACryptoServiceProvider())
            {
                serializedRsa = provider.ToXmlString(true);
            }

            SignatureKey = new JsonWebKey
            {
                Alg    = AllAlg.RS256,
                KeyOps = new KeyOperations[]
                {
                    KeyOperations.Sign,
                    KeyOperations.Verify
                },
                Kid           = "1",
                Kty           = KeyType.RSA,
                Use           = Use.Sig,
                SerializedKey = serializedRsa,
            };
            ModelSignatureKey = new JsonWebKey
            {
                Alg    = AllAlg.RS256,
                KeyOps = new KeyOperations[]
                {
                    KeyOperations.Encrypt,
                    KeyOperations.Decrypt
                },
                Kid           = "2",
                Kty           = KeyType.RSA,
                Use           = Use.Sig,
                SerializedKey = serializedRsa,
            };
            EncryptionKey = new JsonWebKey
            {
                Alg    = AllAlg.RSA1_5,
                KeyOps = new[]
                {
                    KeyOperations.Decrypt,
                    KeyOperations.Encrypt
                },
                Kid           = "3",
                Kty           = KeyType.RSA,
                Use           = Use.Enc,
                SerializedKey = serializedRsa,
            };
            ModelEncryptionKey = new JsonWebKey
            {
                Alg    = AllAlg.RSA1_5,
                KeyOps = new KeyOperations[]
                {
                    KeyOperations.Encrypt,
                    KeyOperations.Decrypt
                },
                Kid           = "4",
                Kty           = KeyType.RSA,
                Use           = Use.Enc,
                SerializedKey = serializedRsa,
            };
            HttpClientFactory     = new FakeHttpClientFactory();
            ConfirmationCodeStore = new Mock <IConfirmationCodeStore>();
            TwilioClient          = new Mock <ITwilioClient>();
            Oauth2IntrospectionHttpClientFactory = new Mock <IHttpClientFactory>();
        }