File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1114,10 +1114,42 @@ int RsGenExchange::validateGrp(RsNxsGrp* grp)
11141114 }
11151115
11161116 if (idValidate)
1117+ {
1118+ // Validate admin signature
1119+ RsTlvSecurityKeySet keys = metaData.keys ;
1120+ GxsSecurity::createPublicKeysFromPrivateKeys (keys);
1121+ std::map<RsGxsId, RsTlvPublicRSAKey>& public_keys = keys.public_keys ;
1122+ std::map<RsGxsId, RsTlvPublicRSAKey>::iterator keyMit = public_keys.find (RsGxsId (metaData.mGroupId ));
1123+
1124+ if (keyMit == public_keys.end ())
1125+ {
1126+ #ifdef GEN_EXCH_DEBUG
1127+ std::cerr << " RsGenExchange::validateGrp() admin key not found! " << std::endl;
1128+ #endif
1129+ return VALIDATE_FAIL;
1130+ }
1131+
1132+ std::map<SignType, RsTlvKeySignature>& signSet = metaData.signSet .keySignSet ;
1133+ std::map<SignType, RsTlvKeySignature>::iterator mit = signSet.find (INDEX_AUTHEN_ADMIN);
1134+ if (mit == signSet.end ())
1135+ {
1136+ #ifdef GEN_EXCH_DEBUG
1137+ std::cerr << " RsGenExchange::validateGrp() admin sign not found! " << std::endl;
1138+ std::cerr << " RsGenExchange::validateGrp() grpId: " << metaData.mGroupId << std::endl;
1139+ #endif
1140+ return VALIDATE_FAIL;
1141+ }
1142+ RsTlvKeySignature adminSign = mit->second ;
1143+ if (!GxsSecurity::validateNxsGrp (*grp, adminSign, keyMit->second ))
1144+ {
1145+ return VALIDATE_FAIL;
1146+ }
11171147 return VALIDATE_SUCCESS;
1148+ }
11181149 else
1150+ {
11191151 return VALIDATE_FAIL;
1120-
1152+ }
11211153}
11221154
11231155bool RsGenExchange::checkAuthenFlag (const PrivacyBitPos& pos, const uint8_t & flag) const
You can’t perform that action at this time.
0 commit comments