示例#1
0
        internal IPsecSecurityAssociationAuthInformation(IPSEC_SA0 sa) : base(sa)
        {
            var auth_info = sa.ptr.ReadStruct <IPSEC_SA_AUTH_INFORMATION0>();

            Key            = auth_info.authKey.ToArray();
            CryptoModuleId = auth_info.authTransform.cryptoModuleId.ReadGuid();
            Type           = auth_info.authTransform.authTransformId.authType;
            Config         = auth_info.authTransform.authTransformId.authConfig;
        }
示例#2
0
        internal IPsecSecurityAssociationCipherInformation(IPSEC_SA0 sa) : base(sa)
        {
            var cipher_info = sa.ptr.ReadStruct <IPSEC_SA_CIPHER_INFORMATION0>();

            Key            = cipher_info.cipherKey.ToArray();
            CryptoModuleId = cipher_info.cipherTransform.cryptoModuleId.ReadGuid();
            Type           = cipher_info.cipherTransform.cipherTransformId.cipherType;
            Config         = cipher_info.cipherTransform.cipherTransformId.cipherConfig;
        }
示例#3
0
        internal static IPsecSecurityAssociationParameter Create(IPSEC_SA0 sa)
        {
            switch (sa.saTransformType)
            {
            case IPsecTransformType.AH:
            case IPsecTransformType.EspAuth:
            case IPsecTransformType.EspAuthFw:
                return(new IPsecSecurityAssociationAuthInformation(sa));

            case IPsecTransformType.EspCipher:
                return(new IPsecSecurityAssociationCipherInformation(sa));

            case IPsecTransformType.EspAuthAndCipher:
                return(new IPsecSecurityAssociationAuthCipherInformation(sa));
            }
            return(new IPsecSecurityAssociationParameter(sa));
        }
示例#4
0
        internal IPsecSecurityAssociationAuthCipherInformation(IPSEC_SA0 sa) : base(sa)
        {
            var auth_and_cipher_info = sa.ptr.ReadStruct <IPSEC_SA_AUTH_AND_CIPHER_INFORMATION0>();
            var auth_info            = auth_and_cipher_info.saAuthInformation;

            AuthKey            = auth_info.authKey.ToArray();
            AuthCryptoModuleId = auth_info.authTransform.cryptoModuleId.ReadGuid();
            AuthType           = auth_info.authTransform.authTransformId.authType;
            AuthConfig         = auth_info.authTransform.authTransformId.authConfig;

            var cipher_info = auth_and_cipher_info.saCipherInformation;

            CipherKey            = cipher_info.cipherKey.ToArray();
            CipherCryptoModuleId = cipher_info.cipherTransform.cryptoModuleId.ReadGuid();
            CipherType           = cipher_info.cipherTransform.cipherTransformId.cipherType;
            CipherConfig         = cipher_info.cipherTransform.cipherTransformId.cipherConfig;
        }
示例#5
0
 private protected IPsecSecurityAssociationParameter(IPSEC_SA0 sa)
 {
     Index         = sa.spi;
     TransformType = sa.saTransformType;
 }