I using C.
Code to gen and retrieve the key:
ManagementKeyCertificateKey[] keys = new ManagementKeyCertificateKey[1];
keys[0] = new ManagementKeyCertificateKey();
keys[0].id = "test";
keys[0].key_type = ManagementKeyCertificateKeyType.KTYPE_RSA_PRIVATE;
keys[0].bit_length = 1024;
keys[0].security = ManagementKeyCertificateSecurityType.STYPE_NORMAL;
ManagementKeyCertificateX509Data[] x509Data = new ManagementKeyCertificateX509Data[1];
x509Data[0] = new ManagementKeyCertificateX509Data();
x509Data[0].common_name = "test.com";
x509Data[0].country_name = "US";
x509Data[0].division_name = "Test";
x509Data[0].locality_name = "Test";
x509Data[0].organization_name = "Test";
x509Data[0].state_name = "Utah";
string[] saCsrIds = new string[1];
saCsrIds[0] = "test";
mng.key_generate (ManagementKeyCertificateManagementModeType.MANAGEMENT_MODE_DEFAULT, keys, x509Data, true, true);
string[] saKey = mng.key_export_to_pem(ManagementKeyCertificateManagementModeType.MANAGEMENT_MODE_DEFAULT, saCsrIds);
foreach(string sKeyText in saKey)
{
sReturnKeyText = sKeyText;
}
Code used to import key:
string[] KeyIds = new string[1];
KeyIds[0] = "test";
string[] saKeyText = new string[1];
saKeyText[0] = sReturnKeyText;
mng.key_import_from_pem(ManagementKeyCertificateManagementModeType.MANAGEMENT_MODE_DEFAULT, KeyIds, saKeyText, true);
The key is stored in a database and pulled out when it is needed for the import. This does not seem to be a problem since if i gen the key on one BigIP and delete that key then let my app iport that key it is fine. The only time i see the error is if i try to import the key to a different BigIP.
Thanks for the quick response.