/// <summary> /// Takes in a hash function, and nonce provider, and optional entropy provider (only used for 'random' nonce) /// </summary> /// <param name="hashFunction"></param> /// <param name="nonceProviderTypes"></param> /// <param name="entropyProvider"></param> /// <returns></returns> public IDsaEcc GetInstanceForSignatures(HashFunction hashFunction, NonceProviderTypes nonceProviderTypes, IEntropyProvider entropyProvider = null) { var sha = _shaFactory.GetShaInstance(hashFunction); var hmac = _hmacFactory.GetHmacInstance(hashFunction); var nonceProvider = _nonceProviderFactory.GetNonceProvider(nonceProviderTypes, hmac, entropyProvider); return(new EccDsa(sha, nonceProvider)); }
public IEccNonceProvider GetNonceProvider(NonceProviderTypes nonceTypes, IHmac hmac, IEntropyProvider entropyProvider) { switch (nonceTypes) { case NonceProviderTypes.Deterministic: return(new DeterministicNonceProvider(hmac)); case NonceProviderTypes.Random: return(new RandomNonceProvider(entropyProvider)); } throw new ArgumentException("Invalid nonce type provided"); }