public U2FClientReferenceImpl(IClientCrypto crypto, IOriginVerifier appIdVerifier, IChannelIdProvider channelIdProvider, IU2FServer server, IU2FKey key, IClock clock) { this.crypto = crypto; this.appIdVerifier = appIdVerifier; this.channelIdProvider = channelIdProvider; this.server = server; this.key = key; this.clock = clock; }
public virtual void Setup() { mockKeyPairGenerator = new Mock <IKeyPairGenerator>(); mockKeyHandleGenerator = new Mock <IKeyHandleGenerator>(); mockDataStore = new Mock <IKeyDataStore>(); mockUserPresenceVerifier = new Mock <IUserPresenceVerifier>(); u2FKey = new SimulatedU2FKey(VENDOR_CERTIFICATE, VENDOR_CERTIFICATE_PRIVATE_KEY, mockKeyPairGenerator.Object, mockKeyHandleGenerator.Object, mockDataStore.Object, mockUserPresenceVerifier.Object, new BouncyCastleKeyCrypto()); mockUserPresenceVerifier.Setup(x => x.VerifyUserPresence()) .Returns(UserPresenceVerifierConstants.UserPresentFlag); mockKeyPairGenerator.Setup(x => x.GenerateKeyPair(APP_ID_ENROLL_SHA256, BROWSER_DATA_ENROLL_SHA256)) .Returns(USER_KEY_PAIR_ENROLL); mockKeyPairGenerator.Setup(x => x.EncodePublicKey(USER_PUBLIC_KEY_ENROLL)) .Returns(USER_PUBLIC_KEY_ENROLL_HEX); mockKeyHandleGenerator.Setup(x => x.GenerateKeyHandle(APP_ID_ENROLL_SHA256, USER_KEY_PAIR_ENROLL)) .Returns(KEY_HANDLE); mockDataStore.Setup(x => x.GetKeyPair(KEY_HANDLE)).Returns(USER_KEY_PAIR_SIGN); mockDataStore.Setup(x => x.IncrementCounter()).Returns(COUNTER_VALUE); }