示例#1
0
        public void RecoverEidasTest()
        {
            using (Tokenio.Tpp.TokenClient tokenClient = TestUtil.CreateClient())
                using (Tokenio.Tpp.TokenClient anotherTokenClient = TestUtil.CreateClient()) {
                    var    tppAuthNumber = RandomNumeric(15);
                    var    keyPair       = GenerateKeyPair();
                    string certificate   = GenerateCert(keyPair, tppAuthNumber);
                    string bankId        = "gold";

                    // create and verify member first
                    Member verifiedTppMember = EidasMethodsSample.VerifyEidas(
                        tokenClient,
                        tppAuthNumber,
                        certificate,
                        bankId,
                        keyPair.ParseRsaKeyPair().PrivateKey);

                    // now pretend we lost the keys and need to recover the member
                    Member recoveredMember = EidasMethodsSample.RecoverEidas(
                        anotherTokenClient,
                        verifiedTppMember.MemberId(),
                        tppAuthNumber,
                        certificate,
                        keyPair.ParseRsaKeyPair().PrivateKey);

                    IList <Alias> verifiedAliases = recoveredMember.GetAliasesBlocking();

                    Assert.Equal(1, verifiedAliases.Count);
                    Assert.Equal(tppAuthNumber, verifiedAliases[0].Value);
                    Assert.Equal(Alias.Types.Type.Eidas, verifiedAliases[0].Type);
                }
        }
示例#2
0
 public void VerifyEidasTest()
 {
     using (Tokenio.Tpp.TokenClient tokenClient = TestUtil.CreateClient())
     {
         var    tppAuthNumber     = RandomNumeric(15);
         var    keyPair           = GenerateKeyPair();
         string certificate       = GenerateCert(keyPair, tppAuthNumber);
         Member verifiedTppMember = EidasMethodsSample.VerifyEidas(
             tokenClient,
             tppAuthNumber,
             certificate,
             "gold",
             keyPair.ParseRsaKeyPair().PrivateKey);
         IList <Alias> verifiedAliases = verifiedTppMember.GetAliasesBlocking();
         Assert.Equal(1, verifiedAliases.Count);
         Assert.Equal(tppAuthNumber, verifiedAliases[0].Value);
         Assert.Equal(Alias.Types.Type.Eidas, verifiedAliases[0].Type);
     }
 }