Пример #1
0
        /// <summary>
        /// Constructs Kas parameter information
        /// </summary>
        /// <param name="keyAgreementRole">This party's key agreement role</param>
        /// <param name="kasMode">The mode of the KAS attempt</param>
        /// <param name="keyConfirmationRole">This party's key confirmation role</param>
        /// <param name="keyConfirmationDirection">This party's key confirmation direction</param>
        /// <param name="kasAssurances">The assurances associated with the KAS</param>
        /// <param name="thisPartyId">The ID associated with this party</param>
        protected SchemeParametersBase(
            TKasAlgoAttributes kasAlgoAttributes,
            KeyAgreementRole keyAgreementRole,
            KasMode kasMode,
            KeyConfirmationRole keyConfirmationRole,
            KeyConfirmationDirection keyConfirmationDirection,
            KasAssurance kasAssurances,
            BitString thisPartyId
            )
        {
            if (kasMode != KasMode.NoKdfNoKc && BitString.IsZeroLengthOrNull(thisPartyId))
            {
                throw new ArgumentException(nameof(thisPartyId));
            }

            if (kasMode == KasMode.KdfKc)
            {
                if (keyConfirmationRole == KeyConfirmationRole.None ||
                    keyConfirmationDirection == KeyConfirmationDirection.None)
                {
                    throw new ArgumentException(
                              $"{nameof(KasMode.KdfKc)} requires a valid (not None) value for both {nameof(keyConfirmationRole)} and {nameof(keyConfirmationDirection)}");
                }
            }
            KasAlgoAttributes        = kasAlgoAttributes;
            KeyAgreementRole         = keyAgreementRole;
            KasMode                  = kasMode;
            KeyConfirmationRole      = keyConfirmationRole;
            KeyConfirmationDirection = keyConfirmationDirection;
            KasAssurances            = kasAssurances;
            ThisPartyId              = thisPartyId;
        }
Пример #2
0
 public SchemeParametersIfc(
     KasAlgoAttributesIfc kasAlgoAttributes,
     KeyAgreementRole keyAgreementRole,
     KasMode kasMode,
     KeyConfirmationRole keyConfirmationRole,
     KeyConfirmationDirection keyConfirmationDirection,
     KasAssurance kasAssurances,
     BitString thisPartyId)
     : base(kasAlgoAttributes, keyAgreementRole, kasMode, keyConfirmationRole, keyConfirmationDirection, kasAssurances, thisPartyId)
 {
 }
Пример #3
0
 protected KasBuilderKdfNoKc(
     ISchemeBuilder <TKasDsaAlgoAttributes, TOtherPartySharedInfo, TDomainParameters, TKeyPair> schemeBuilder,
     TKasDsaAlgoAttributes kasDsaAlgoAttributes,
     KeyAgreementRole keyAgreementRole,
     KasAssurance assurances,
     BitString partyId
     )
 {
     _schemeBuilder        = schemeBuilder;
     _kasDsaAlgoAttributes = kasDsaAlgoAttributes;
     _keyAgreementRole     = keyAgreementRole;
     _assurances           = assurances;
     _partyId = partyId;
 }
 public KasBuilderNoKdfNoKcEcc(
     ISchemeBuilder <KasDsaAlgoAttributesEcc, OtherPartySharedInformation <EccDomainParameters, EccKeyPair>, EccDomainParameters, EccKeyPair> schemeBuilder,
     KasDsaAlgoAttributesEcc kasDsaAlgoAttributes,
     KeyAgreementRole keyAgreementRole,
     KasAssurance assurances,
     BitString partyId)
     : base(
         schemeBuilder,
         kasDsaAlgoAttributes,
         keyAgreementRole,
         assurances,
         partyId
         )
 {
 }
Пример #5
0
 public SchemeParameters(
     KasAlgoAttributes kasAlgoAttributes,
     KeyAgreementRole keyAgreementRole,
     KasMode kasMode,
     KeyConfirmationRole keyConfirmationRole,
     KeyConfirmationDirection keyConfirmationDirection,
     KasAssurance kasAssurances,
     BitString thisPartyId
     ) : base(kasAlgoAttributes, keyAgreementRole, kasMode, keyConfirmationRole, keyConfirmationDirection, kasAssurances, thisPartyId)
 {
     KasAlgorithm = KasEnumMapping.GetSchemeRequirements(
         kasAlgoAttributes.KasScheme,
         kasMode,
         keyAgreementRole,
         keyConfirmationRole,
         keyConfirmationDirection).kasAlgo;
 }
Пример #6
0
 WithAssurances(KasAssurance value)
 {
     _assurances = value;
     return(this);
 }