コード例 #1
0
        public SchemeFfcDhHybrid1(
            IDsaFfc dsa,
            IKdfOneStepFactory kdfFactory,
            IKeyConfirmationFactory keyConfirmationFactory,
            INoKeyConfirmationFactory noKeyConfirmationFactory,
            IOtherInfoFactory otherInfoFactory,
            IEntropyProvider entropyProvider,
            SchemeParametersBase <KasDsaAlgoAttributesFfc> schemeParameters,
            KdfParameters kdfParameters,
            MacParameters macParameters,
            IDiffieHellman <FfcDomainParameters, FfcKeyPair> diffieHellman
            ) :
            base(
                dsa,
                kdfFactory,
                keyConfirmationFactory,
                noKeyConfirmationFactory,
                otherInfoFactory,
                entropyProvider,
                schemeParameters,
                kdfParameters,
                macParameters
                )
        {
            _diffieHellman = diffieHellman;

            if (SchemeParameters.KasAlgoAttributes.Scheme != FfcScheme.DhHybrid1)
            {
                throw new ArgumentException(nameof(SchemeParameters.KasAlgoAttributes.Scheme));
            }
        }
コード例 #2
0
        public SchemeFfcMqv2(
            IDsaFfc dsa,
            IKdfOneStepFactory kdfFactory,
            IKeyConfirmationFactory keyConfirmationFactory,
            INoKeyConfirmationFactory noKeyConfirmationFactory,
            IOtherInfoFactory otherInfoFactory,
            IEntropyProvider entropyProvider,
            SchemeParametersBase <KasDsaAlgoAttributesFfc> schemeParameters,
            KdfParameters kdfParameters,
            MacParameters macParameters,
            IMqv <FfcDomainParameters, FfcKeyPair> mqv
            ) :
            base(
                dsa,
                kdfFactory,
                keyConfirmationFactory,
                noKeyConfirmationFactory,
                otherInfoFactory,
                entropyProvider,
                schemeParameters,
                kdfParameters,
                macParameters
                )
        {
            _mqv = mqv;

            if (SchemeParameters.KasAlgoAttributes.Scheme != FfcScheme.Mqv2)
            {
                throw new ArgumentException(nameof(SchemeParameters.KasAlgoAttributes.Scheme));
            }
        }
コード例 #3
0
        public SchemeEccFullMqv(
            IDsaEcc dsa,
            IEccCurveFactory curveFactory,
            IKdfOneStepFactory kdfFactory,
            IKeyConfirmationFactory keyConfirmationFactory,
            INoKeyConfirmationFactory noKeyConfirmationFactory,
            IOtherInfoFactory otherInfoFactory,
            IEntropyProvider entropyProvider,
            SchemeParametersBase <KasDsaAlgoAttributesEcc> schemeParameters,
            KdfParameters kdfParameters,
            MacParameters macParameters,
            IMqv <EccDomainParameters, EccKeyPair> mqv
            ) :
            base(
                dsa,
                curveFactory,
                kdfFactory,
                keyConfirmationFactory,
                noKeyConfirmationFactory,
                otherInfoFactory,
                entropyProvider,
                schemeParameters,
                kdfParameters,
                macParameters
                )
        {
            _mqv = mqv;

            if (SchemeParameters.KasAlgoAttributes.Scheme != EccScheme.FullMqv)
            {
                throw new ArgumentException(nameof(SchemeParameters.KasAlgoAttributes.Scheme));
            }
        }
コード例 #4
0
        public SchemeEccOnePassUnified(
            IDsaEcc dsa,
            IEccCurveFactory curveFactory,
            IKdfOneStepFactory kdfFactory,
            IKeyConfirmationFactory keyConfirmationFactory,
            INoKeyConfirmationFactory noKeyConfirmationFactory,
            IOtherInfoFactory otherInfoFactory,
            IEntropyProvider entropyProvider,
            SchemeParametersBase <KasDsaAlgoAttributesEcc> schemeParameters,
            KdfParameters kdfParameters,
            MacParameters macParameters,
            IDiffieHellman <EccDomainParameters, EccKeyPair> diffieHellman
            )
            : base(
                dsa,
                curveFactory,
                kdfFactory,
                keyConfirmationFactory,
                noKeyConfirmationFactory,
                otherInfoFactory,
                entropyProvider,
                schemeParameters,
                kdfParameters,
                macParameters
                )
        {
            _diffieHellman = diffieHellman;

            if (SchemeParameters.KasAlgoAttributes.Scheme != EccScheme.OnePassUnified)
            {
                throw new ArgumentException(nameof(SchemeParameters.KasAlgoAttributes.Scheme));
            }
        }
コード例 #5
0
 public SchemeEccStaticUnified(
     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;
 }
コード例 #6
0
        public SchemeFfcDiffieHellmanEphemeral(
            IDsaFfc dsa,
            IKdfOneStepFactory kdfFactory,
            IKeyConfirmationFactory keyConfirmationFactory,
            INoKeyConfirmationFactory noKeyConfirmationFactory,
            IOtherInfoFactory otherInfoFactory,
            IEntropyProvider entropyProvider,
            SchemeParametersBase<KasDsaAlgoAttributesFfc> schemeParameters,
            KdfParameters kdfParameters,
            MacParameters macParameters,
            IDiffieHellman<FfcDomainParameters, FfcKeyPair> dh
        )
            : base(dsa, kdfFactory, keyConfirmationFactory, noKeyConfirmationFactory, otherInfoFactory, entropyProvider, schemeParameters, kdfParameters, macParameters)
        {
            _diffieHellman = dh;

            if (SchemeParameters.KasAlgoAttributes.Scheme != FfcScheme.DhEphem)
            {
                throw new ArgumentException(nameof(SchemeParameters.KasAlgoAttributes.Scheme));
            }

            if (SchemeParameters.KasMode == KasMode.KdfKc)
            {
                throw new ArgumentException($"{SchemeParameters.KasMode} not possible with {SchemeParameters.KasAlgoAttributes.Scheme}");
            }
        }
コード例 #7
0
 protected SchemeBaseEcc(
     IDsaEcc dsa,
     IEccCurveFactory eccCurveFactory,
     IKdfOneStepFactory kdfFactory,
     IKeyConfirmationFactory keyConfirmationFactory,
     INoKeyConfirmationFactory noKeyConfirmationFactory,
     IOtherInfoFactory otherInfoFactory,
     IEntropyProvider entropyProvider,
     SchemeParametersBase <KasDsaAlgoAttributesEcc> schemeParameters,
     KdfParameters kdfParameters,
     MacParameters macParameters
     )
     : base(
         kdfFactory,
         keyConfirmationFactory,
         noKeyConfirmationFactory,
         otherInfoFactory,
         entropyProvider,
         schemeParameters,
         kdfParameters,
         macParameters
         )
 {
     Dsa             = dsa;
     EccCurveFactory = eccCurveFactory;
 }
コード例 #8
0
 protected void SetWithInjectablesToConstructionState()
 {
     _withKdfFactory               = _originalKdfFactory;
     _withKeyConfirmationFactory   = _originalKeyConfirmationFactory;
     _withNoKeyConfirmationFactory = _originalNoKeyConfirmationFactory;
     _withOtherInfoFactory         = _originalOtherInfoFactory;
     _withEntropyProvider          = _originalEntropyProvider;
     _withDiffieHellman            = _originalDiffieHellmanFfc;
     _withMqv = _originalMqv;
 }
コード例 #9
0
        public SchemeEccOnePassDh(
            IDsaEcc dsa,
            IEccCurveFactory curveFactory,
            IKdfOneStepFactory kdfFactory,
            IKeyConfirmationFactory keyConfirmationFactory,
            INoKeyConfirmationFactory noKeyConfirmationFactory,
            IOtherInfoFactory otherInfoFactory,
            IEntropyProvider entropyProvider,
            SchemeParametersBase <KasDsaAlgoAttributesEcc> schemeParameters,
            KdfParameters kdfParameters,
            MacParameters macParameters,
            IDiffieHellman <EccDomainParameters, EccKeyPair> diffieHellman
            ) :
            base(
                dsa,
                curveFactory,
                kdfFactory,
                keyConfirmationFactory,
                noKeyConfirmationFactory,
                otherInfoFactory,
                entropyProvider,
                schemeParameters,
                kdfParameters,
                macParameters
                )
        {
            _diffieHellman = diffieHellman;

            if (SchemeParameters.KasAlgoAttributes.Scheme != EccScheme.OnePassDh)
            {
                throw new ArgumentException(nameof(SchemeParameters.KasAlgoAttributes.Scheme));
            }

            if (SchemeParameters.KeyConfirmationDirection == KeyConfirmationDirection.Bilateral ||
                (SchemeParameters.KeyAgreementRole == KeyAgreementRole.InitiatorPartyU &&
                 SchemeParameters.KeyConfirmationRole == KeyConfirmationRole.Provider) ||
                (SchemeParameters.KeyAgreementRole == KeyAgreementRole.ResponderPartyV &&
                 SchemeParameters.KeyConfirmationRole == KeyConfirmationRole.Recipient))
            {
                throw new ArgumentException("Only unilateral Key confirmation possible party V to U");
            }
        }
コード例 #10
0
 public SchemeBuilderFfc(
     IDsaFfcFactory dsaFfcFactory,
     IKdfOneStepFactory kdfFactory,
     IKeyConfirmationFactory keyConfirmationFactory,
     INoKeyConfirmationFactory noKeyConfirmationFactory,
     IOtherInfoFactory otherInfoFactory,
     IEntropyProvider entropyProvider,
     IDiffieHellman <FfcDomainParameters, FfcKeyPair> diffieHellmanFfc,
     IMqv <FfcDomainParameters, FfcKeyPair> mqv)
     : base(
         kdfFactory,
         keyConfirmationFactory,
         noKeyConfirmationFactory,
         otherInfoFactory,
         entropyProvider,
         diffieHellmanFfc,
         mqv)
 {
     _dsaFfcFactory = dsaFfcFactory;
 }
コード例 #11
0
        protected SchemeBuilderBase(
            IKdfOneStepFactory kdfFactory,
            IKeyConfirmationFactory keyConfirmationFactory,
            INoKeyConfirmationFactory noKeyConfirmationFactory,
            IOtherInfoFactory otherInfoFactory,
            IEntropyProvider entropyProvider,
            IDiffieHellman <TDomainParameters, TKeyPair> diffieHellmanFfc,
            IMqv <TDomainParameters, TKeyPair> mqv
            )
        {
            _originalKdfFactory               = kdfFactory;
            _originalKeyConfirmationFactory   = keyConfirmationFactory;
            _originalNoKeyConfirmationFactory = noKeyConfirmationFactory;
            _originalOtherInfoFactory         = otherInfoFactory;
            _originalEntropyProvider          = entropyProvider;
            _originalDiffieHellmanFfc         = diffieHellmanFfc;
            _originalMqv = mqv;

            SetWithInjectablesToConstructionState();
        }
コード例 #12
0
 protected SchemeBase(
     IKdfOneStepFactory kdfFactory,
     IKeyConfirmationFactory keyConfirmationFactory,
     INoKeyConfirmationFactory noKeyConfirmationFactory,
     IOtherInfoFactory otherInfoFactory,
     IEntropyProvider entropyProvider,
     TSchemeParameters schemeParameters,
     KdfParameters kdfParameters,
     MacParameters macParameters
     )
 {
     KdfFactory               = kdfFactory;
     KeyConfirmationFactory   = keyConfirmationFactory;
     NoKeyConfirmationFactory = noKeyConfirmationFactory;
     OtherInfoFactory         = otherInfoFactory;
     EntropyProvider          = entropyProvider;
     SchemeParameters         = schemeParameters;
     KdfParameters            = kdfParameters;
     MacParameters            = macParameters;
 }
コード例 #13
0
 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;
 }
コード例 #14
0
 public FakeNoKeyConfirmationFactory_BadMacData()
 {
     _noKeyConfirmationFactory = new NoKeyConfirmationFactory(
         new FakeNoKeyConfirmationMacDataCreator(new NoKeyConfirmationMacDataCreator()));
 }
コード例 #15
0
 WithNoKeyConfirmationFactory(INoKeyConfirmationFactory noKeyConfirmationFactory)
 {
     _withNoKeyConfirmationFactory = noKeyConfirmationFactory;
     return(this);
 }