| 6566 | |
| 6567 | |
| 6568 | void rem_port::start_crypt(P_CRYPT * crypt, PACKET* sendL) |
| 6569 | /***************************************** |
| 6570 | * |
| 6571 | * s t a r t _ c r y p t |
| 6572 | * |
| 6573 | ***************************************** |
| 6574 | * |
| 6575 | * Functional description |
| 6576 | * Start to crypt the wire using given plugin and key. |
| 6577 | * Disconnect on error but send OK on success. |
| 6578 | * |
| 6579 | *****************************************/ |
| 6580 | { |
| 6581 | try |
| 6582 | { |
| 6583 | ICryptKey* key = NULL; |
| 6584 | PathName keyName(crypt->p_key.cstr_address, crypt->p_key.cstr_length); |
| 6585 | if (getPortConfig()->getWireCrypt(WC_SERVER) != WIRE_CRYPT_DISABLED) |
| 6586 | { |
| 6587 | for (unsigned k = 0; k < port_crypt_keys.getCount(); ++k) |
| 6588 | { |
| 6589 | if (keyName == port_crypt_keys[k]->keyName) |
| 6590 | { |
| 6591 | key = port_crypt_keys[k]; |
| 6592 | break; |
| 6593 | } |
| 6594 | } |
| 6595 | } |
| 6596 | |
| 6597 | if (! key) |
| 6598 | { |
| 6599 | (Arg::Gds(isc_wirecrypt_key) << keyName).raise(); |
| 6600 | } |
| 6601 | |
| 6602 | PathName plugName(crypt->p_plugin.cstr_address, crypt->p_plugin.cstr_length); |
| 6603 | // Check it's availability |
| 6604 | ParsedList plugins(Config::getDefaultConfig()->getPlugins( |
| 6605 | IPluginManager::TYPE_WIRE_CRYPT)); |
| 6606 | |
| 6607 | bool found = false; |
| 6608 | |
| 6609 | for (unsigned n = 0; n < plugins.getCount(); ++n) |
| 6610 | { |
| 6611 | if (plugins[n] == plugName) |
| 6612 | { |
| 6613 | found = true; |
| 6614 | break; |
| 6615 | } |
| 6616 | } |
| 6617 | if (!found) |
| 6618 | { |
| 6619 | (Arg::Gds(isc_wirecrypt_plugin) << plugName).raise(); |
| 6620 | } |
| 6621 | |
| 6622 | GetPlugins<IWireCryptPlugin> cp(IPluginManager::TYPE_WIRE_CRYPT, plugName.c_str()); |
| 6623 | if (!cp.hasData()) |
| 6624 | { |
| 6625 | (Arg::Gds(isc_wirecrypt_plugin) << plugName).raise(); |
no test coverage detected