public SchemeEccEphemeralUnified( IDsaEcc dsa, IEccCurveFactory eccCurveFactory, IKdfOneStepFactory kdfFactory, IKeyConfirmationFactory keyConfirmationFactory, INoKeyConfirmationFactory noKeyConfirmationFactory, IOtherInfoFactory otherInfoFactory, IEntropyProvider entropyProvider, SchemeParametersBase <KasDsaAlgoAttributesEcc> schemeParameters, KdfParameters kdfParameters, MacParameters macParameters, IDiffieHellman <EccDomainParameters, EccKeyPair> diffieHellman ) : base( dsa, eccCurveFactory, kdfFactory, keyConfirmationFactory, noKeyConfirmationFactory, otherInfoFactory, entropyProvider, schemeParameters, kdfParameters, macParameters ) { _diffieHellman = diffieHellman; if (SchemeParameters.KasAlgoAttributes.Scheme != EccScheme.EphemeralUnified) { throw new ArgumentException(nameof(SchemeParameters.KasAlgoAttributes.Scheme)); } if (SchemeParameters.KasMode == KasMode.KdfKc) { throw new ArgumentException($"{SchemeParameters.KasMode} not possible with {SchemeParameters.KasAlgoAttributes.Scheme}"); } }
public SchemeBuilderEcc( IDsaEccFactory dsaEccFactory, IEccCurveFactory eccCurveFactory, IKdfOneStepFactory kdfFactory, IKeyConfirmationFactory keyConfirmationFactory, INoKeyConfirmationFactory noKeyConfirmationFactory, IOtherInfoFactory otherInfoFactory, IEntropyProvider entropyProvider, IDiffieHellman <EccDomainParameters, EccKeyPair> diffieHellmanEcc, IMqv <EccDomainParameters, EccKeyPair> mqv) : base( kdfFactory, keyConfirmationFactory, noKeyConfirmationFactory, otherInfoFactory, entropyProvider, diffieHellmanEcc, mqv ) { _dsaEccFactory = dsaEccFactory; _eccCurveFactory = eccCurveFactory; }
protected SchemeBaseFfc( IDsaFfc dsa, IKdfOneStepFactory kdfFactory, IKeyConfirmationFactory keyConfirmationFactory, INoKeyConfirmationFactory noKeyConfirmationFactory, IOtherInfoFactory otherInfoFactory, IEntropyProvider entropyProvider, SchemeParametersBase <KasDsaAlgoAttributesFfc> schemeParameters, KdfParameters kdfParameters, MacParameters macParameters ) : base( kdfFactory, keyConfirmationFactory, noKeyConfirmationFactory, otherInfoFactory, entropyProvider, schemeParameters, kdfParameters, macParameters ) { Dsa = dsa; }
public SchemeKts( IEntropyProvider entropyProvider, SchemeParametersIfc schemeParameters, IFixedInfoFactory fixedInfoFactory, FixedInfoParameter fixedInfoParameter, IIfcSecretKeyingMaterialBuilder thisPartyKeyingMaterialBuilder, IKeyConfirmationFactory keyConfirmationFactory, MacParameters macParameters, IKtsFactory ktsFactory, KtsParameter ktsParameter ) : base ( entropyProvider, schemeParameters, fixedInfoFactory, fixedInfoParameter, thisPartyKeyingMaterialBuilder, keyConfirmationFactory, macParameters) { _ktsFactory = ktsFactory; _ktsParameter = ktsParameter; }
public SchemeBaseKasOneKeyPair( IEntropyProvider entropyProvider, SchemeParametersIfc schemeParameters, IFixedInfoFactory fixedInfoFactory, FixedInfoParameter fixedInfoParameter, IIfcSecretKeyingMaterialBuilder thisPartyKeyingMaterialBuilder, IKeyConfirmationFactory keyConfirmationFactory, MacParameters macParameters, IKdfVisitor kdfVisitor, IKdfParameter kdfParameter, IRsaSve rsaSve) : base( entropyProvider, schemeParameters, fixedInfoFactory, fixedInfoParameter, thisPartyKeyingMaterialBuilder, keyConfirmationFactory, macParameters, kdfVisitor, kdfParameter, rsaSve) { }
/// <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)); }
/// <summary> /// Takes in completed entropy provider and returns an ECDSA Key Generator /// </summary> /// <param name="keyEntropy">Completed entropy provider (BigInteger)</param> /// <returns></returns> public IDsaEcc GetInstanceForKeys(IEntropyProvider keyEntropy) { return(new EccDsa(keyEntropy)); }
public KdfMultiExpansionParameterVisitor(IEntropyProvider entropyProvider, IRandom800_90 random) { _entropyProvider = entropyProvider; _random = random; }
public PssPadderWithModifiedSignature(ISha sha, IMaskFunction mask, IEntropyProvider entropy, int saltLength) : base(sha, mask, entropy, saltLength) { }
/// <summary> /// KAS constructor /// </summary> /// <param name="sha">The SHA instance.</param> /// <param name="entropyProvider">An entropy provider.</param> public EccDsa(ISha sha, IEntropyProvider entropyProvider) { Sha = sha; _entropyProvider = entropyProvider; }
public FakeDrbgCounterAes(IEntropyProvider entropyProvider, IBlockCipherEngineFactory engineFactory, IModeBlockCipherFactory cipherFactory, DrbgParameters drbgParameters) : base(entropyProvider, engineFactory, cipherFactory, drbgParameters) { }
public IRsaSveBuilder WithEntropyProvider(IEntropyProvider value) { _entropProvider = value; return(this); }
public PreSigVerMessageRandomizer(IEntropyProvider entropyProvider) { _entropyProvider = entropyProvider; }
public IFips186_2PrimeGenerator GetFips186_2PrimeGenerator(IEntropyProvider entropyProvider, PrimeTestModes primeTest) { return(new RandomProbablePrimeGenerator(entropyProvider, primeTest)); }
private static IPrimeGenerator GetPrimeGenerator(PrimeGenModes primeGen, ISha sha, IEntropyProvider entropyProvider, PrimeTestModes primeTest) { switch (primeGen) { case PrimeGenModes.RandomProvablePrimes: return(new RandomProvablePrimeGenerator(sha)); case PrimeGenModes.RandomProbablePrimes: return(new RandomProbablePrimeGenerator(entropyProvider, primeTest)); case PrimeGenModes.RandomProvablePrimesWithAuxiliaryProvablePrimes: return(new AllProvablePrimesWithConditionsGenerator(sha)); case PrimeGenModes.RandomProbablePrimesWithAuxiliaryProvablePrimes: return(new ProvableProbablePrimesWithConditionsGenerator(sha, entropyProvider, primeTest)); case PrimeGenModes.RandomProbablePrimesWithAuxiliaryProbablePrimes: return(new AllProbablePrimesWithConditionsGenerator(entropyProvider, primeTest)); default: throw new ArgumentException("Invalid prime gen mode"); } }
public IFips186_4PrimeGenerator GetFips186_4PrimeGenerator(PrimeGenModes primeGen, ISha sha, IEntropyProvider entropyProvider, PrimeTestModes primeTest) { return(GetPrimeGenerator(primeGen, sha, entropyProvider, primeTest) as IFips186_4PrimeGenerator); }
public ProvablePQGeneratorValidator(ISha sha, EntropyProviderTypes entropyType = EntropyProviderTypes.Random) { _sha = sha; _entropy = _entropyFactory.GetEntropyProvider(entropyType); }
> WithEntropyProvider(IEntropyProvider entropyProvider) { _withEntropyProvider = entropyProvider; return(this); }
// Used for both signatures and keys public EccDsa(ISha sha, IEccNonceProvider nonceProvider, EntropyProviderTypes entropyType) { Sha = sha; _nonceProvider = nonceProvider; _entropyProvider = _entropyFactory.GetEntropyProvider(entropyType); }
public DrbgHash(IEntropyProvider entropyProvider, ISha sha, DrbgParameters drbgParameters) : base(entropyProvider, drbgParameters) { _sha = sha; HashAttributes = DrbgAttributesHelper.GetHashDrbgAttributes(drbgParameters.Mode); }
// Used for ONLY keys public EccDsa(IEntropyProvider entropyProvider) { _entropyProvider = entropyProvider; }
public RandomNonceProvider(IEntropyProvider entropyProvider) { _entropyProvider = entropyProvider; }
public AllProbablePrimesWithConditionsGenerator(IEntropyProvider entropyProvider, PrimeTestModes primeTestMode) { _entropyProvider = entropyProvider; _primeTestMode = primeTestMode; }
/// Always correct public IPaddingScheme GetPaddingScheme(SignatureSchemes sigMode, ISha sha, PssMaskTypes maskType = PssMaskTypes.None, IEntropyProvider entropyProvider = null, int saltLength = 0) { switch (sigMode) { case SignatureSchemes.Ansx931: return(new AnsxPadder(sha)); case SignatureSchemes.Pkcs1v15: return(new PkcsPadder(sha)); case SignatureSchemes.Pss: var mask = _maskFactory.GetMaskInstance(maskType, sha.HashFunction); return(new PssPadder(sha, mask, entropyProvider, saltLength)); default: throw new ArgumentException("Invalid signature scheme"); } }
public ISchemeIfcBuilder WithEntropyProvider(IEntropyProvider value) { _entropyProvider = value; return(this); }
public DrbgCounterAes(IEntropyProvider entropyProvider, IBlockCipherEngineFactory engineFactory, IModeBlockCipherFactory cipherFactory, DrbgParameters drbgParameters) : base(entropyProvider, drbgParameters) { Cipher = cipherFactory.GetStandardCipher( engineFactory.GetSymmetricCipherPrimitive(BlockCipherEngines.Aes), BlockCipherModesOfOperation.Ecb); }
public ProvableProbablePrimesWithConditionsGenerator(ISha sha, IEntropyProvider entropyProvider, PrimeTestModes primeTest) { _sha = sha; _entropyProvider = entropyProvider; _primeTest = primeTest; }
public DrbgHmac(IEntropyProvider entropyProvider, IHmac hmac, DrbgParameters drbgParameters) : base(entropyProvider, drbgParameters) { _hmac = hmac; HashAttributes = DrbgAttributesHelper.GetHashDrbgAttributes(drbgParameters.Mode); }
public FfcDsa(ISha sha, EntropyProviderTypes entropyType = EntropyProviderTypes.Random) { Sha = sha; _entropyProvider = _entropyFactory.GetEntropyProvider(entropyType); }
/// Could introduce errors public IPaddingScheme GetSigningPaddingScheme(SignatureSchemes sigMode, ISha sha, SignatureModifications errors, PssMaskTypes maskType = PssMaskTypes.None, IEntropyProvider entropyProvider = null, int saltLength = 0) { if (sigMode == SignatureSchemes.Ansx931) { switch (errors) { case SignatureModifications.None: return(new AnsxPadder(sha)); case SignatureModifications.E: return(new AnsxPadderWithModifiedPublicExponent(sha)); case SignatureModifications.Message: return(new AnsxPadderWithModifiedMessage(sha)); case SignatureModifications.ModifyTrailer: return(new AnsxPadderWithModifiedTrailer(sha)); case SignatureModifications.MoveIr: return(new AnsxPadderWithMovedIr(sha)); case SignatureModifications.Signature: return(new AnsxPadderWithModifiedSignature(sha)); default: throw new ArgumentException("Signature modification does not exist for selected scheme"); } } else if (sigMode == SignatureSchemes.Pkcs1v15) { switch (errors) { case SignatureModifications.None: return(new PkcsPadder(sha)); case SignatureModifications.E: return(new PkcsPadderWithModifiedPublicExponent(sha)); case SignatureModifications.Message: return(new PkcsPadderWithModifiedMessage(sha)); case SignatureModifications.ModifyTrailer: return(new PkcsPadderWithModifiedTrailer(sha)); case SignatureModifications.MoveIr: return(new PkcsPadderWithMovedIr(sha)); case SignatureModifications.Signature: return(new PkcsPadderWithModifiedSignature(sha)); default: throw new ArgumentException("Signature modification does not exist for selected scheme"); } } else if (sigMode == SignatureSchemes.Pss) { var mask = _maskFactory.GetMaskInstance(maskType, sha.HashFunction); switch (errors) { case SignatureModifications.None: return(new PssPadder(sha, mask, entropyProvider, saltLength)); case SignatureModifications.E: return(new PssPadderWithModifiedPublicExponent(sha, mask, entropyProvider, saltLength)); case SignatureModifications.Message: return(new PssPadderWithModifiedMessage(sha, mask, entropyProvider, saltLength)); case SignatureModifications.ModifyTrailer: return(new PssPadderWithModifiedTrailer(sha, mask, entropyProvider, saltLength)); case SignatureModifications.MoveIr: return(new PssPadderWithMovedIr(sha, mask, entropyProvider, saltLength)); case SignatureModifications.Signature: return(new PssPadderWithModifiedSignature(sha, mask, entropyProvider, saltLength)); default: throw new ArgumentException("Signature modification does not exist for selected scheme"); } } throw new ArgumentException("Invalid signature scheme"); }