This web application allows you to encrypt NCM API keys (APIv2 and APIv3) into group or device configurations. The encrypted keys can then be used by SDK applications running on the devices.
- Python 3.x
- Flask
- ncm library
- Install dependencies:
pip install -r requirements.txtOn startup, the app will load the admin API keys (the first form on the page) from these environment variables if set:
X_ECM_API_IDX_ECM_API_KEYX_CP_API_IDX_CP_API_KEYorNCM_API_TOKEN
If all four keys are present and valid, admin authentication is applied automatically and Step 2 will be available on first load.
- Run the application:
python3 ncm_api_key_encryptor.py # macOS/Linux
python ncm_api_key_encryptor.py # Windows- Open your browser and navigate to:
http://localhost:8000
-
Step 1: Admin NCM APIv2 Keys
- Enter your admin API keys that have authorization to the target group or device
- These keys are used for authentication only and will not be added to configurations
- Click "Set Admin Keys & Verify" to validate your keys
-
Step 2: API Keys to Add to Configuration
- Enter the API keys you want to encrypt into the group or device configuration
- You can use either:
- All 4 APIv2 keys (X-ECM-API-ID, X-ECM-API-KEY, X-CP-API-ID, X-CP-API-KEY)
- OR an APIv3 Token
- Select the destination (Group or Device)
- Enter the ID or Name of the target
- Click "Submit" to encrypt and set the keys
- Admin keys must have authorization to the target group or device
- Admin keys are stored in session and will persist across page refreshes
- Use the "Clear Admin Keys" button to reset the session