Security > Secure Key Manager > Key Rotation Guide for Enhanced Security
This guide explains how to enhance security in production environments by leveraging the key rotation features of Secure Key Manager (SKM).
Note
This guide is intended for current users of the Secure Key Manager (SKM) service. If you are a new user, please refer to the Secure Key Manager Overview first.
To help you follow along more easily, please review these key terms first.
| Terms | Description |
|---|---|
| Key rotation | Key rotation is the process of periodically replacing encryption keys with new ones to strengthen security. It is similar to the concept of regularly changing your passwords. |
| Envelope encryption | This is a method of encrypting data in two stages. It provides double protection, much like placing a sensitive document in an envelope and then securing that envelope inside a safe. |
| Data encryption key(DEK) | The key used to encrypt the actual data. It acts as the "envelope" in envelope encryption. |
| Key encryption key(KEK) | The key used to encrypt the DEK. The symmetric key managed by Secure Key Manager plays this role. It acts as the 'vault' in envelope encryption. |
| Key segmentation | A strategy for encrypting data with multiple keys, rather than encrypting all data with a single key. This can be by time of day, by region, by user group, and so on. It's the same principle as not putting all your eggs in one basket. |
Prolonged use of encryption keys increases the following security risks:
Secure Key Manager's key rotation feature allows you to renew only the key value without changing the key ID, increasing security without modifying your application code.
Your key rotation strategy should be based on the business impact and security requirements of your service.
Note
You can set the auto-rotation interval to as little as 30 days.
Envelope encryption is an encryption pattern that can efficiently implement key rotation.
Envelope encryption is a method of encrypting data through a two-step process. Let's compare how it differs from traditional encryption methods.
[User data] → [Encrypt directly with encryption key] → [Encrypted data] (DB storage)
The problem with this approach is that if the key is compromised, all data is at risk, and changing the key requires re-encrypting all data.
[User Data] → [Encrypt with DEK] → [Encrypted Data] (Save to DB)
[DEK] → [Encrypt with KEK] → [DEK ciphertext] (KEK stored in Secure Key Manager, DEK ciphertext stored in DB or Secure Key Manager)
Envelope encryption offers the following security advantages over regular encryption methods:
Think about the process of periodically updating the access code for your home’s smart lock.
Single-key method
Key rotation requires → 1 million re-encryptions of data (very time consuming)
Envelope encryption method
Upon key rotation → Actual user data remains intact, no re-encryption required
→ Only the DEK ciphertext is re-encrypted with the new KEK version
→ Automatically uses new KEK version without changing application code
This structure allows envelope cryptography to minimize the operational burden of key rotation while maintaining a high level of security.
When using Secure Key Manager in the form of envelope encryption, we recommend having the following flow:

Caution
Calling the Secure Key Manager API directly for every request that requires a key can cause response delays. Use appropriate caching to optimize performance.
If you encrypt all your data with a single key, it is at risk if that key is leaked. To avoid this, you can use a key segmentation strategy to minimize the scope of damage.
[1 million total customer data]
↓
[Encrypted with a single DEK]
↓
In the event of a key compromise → Full exposure of 1 million records
[1 million customer data]
↓
[Use of multiple DEKs by region/period/customer class]
↓
If 1 DEK is breached, → only 100K cases are at risk (90% less damage)
This method uses different keys depending on when the data was generated.
How to implement.
2026-01 → Key ID: abc123..., 2026-02 → Key ID: def456...).keyId: abc123..., version: 0).Note
Keys in Secure Key Manager are managed by key ID in UUID format and version starting from 0. When rotating keys, the version increases from 0 → 1 → 2, so your application must record which version it encrypted with.
Advantages
Examples
January 2026 data: Key ID abc123... (100K entries)
February 2026 data: Key ID def456... (100K entries)
March 2026 data: Key ID ghi789... (100K entries)
→ January key (abc123...) leaked: Only 100K January data affected
This method uses different keys based on user attributes.
**How to implement
**Method 1: Hash-based partitioning
Note
A hash function is a function that converts an input value into a unique value of fixed length. The same input value always produces the same result, allowing you to assign consistent keys per user.
0 → key ID: abc123..., 1 → key ID: def456...).**Method 2: Split by customer tier
VIP → Key ID: abc123..., PREMIUM → Key ID: def456...).Advantages.
Scenario: Split 1 million customer data into 10 keys.
Initial state
- 10 key IDs (abc123..., def456..., ghi789..., etc.), each holding 100K cases of data
- Manage each key independently
Incident
→ Key ID ghi789... Suspected Breach
Countermeasures
1. Key ID ghi789... Rotate immediately
2. Re-encrypt only 100K data encrypted with that key
3. The other 9 keys are unaffected
Results
✅ Impacted: 100K (10% of total)
✅ Re-encryption time: Approximately 1 hour (10 hours for full re-encryption → 90% reduction)
✅ Service impact: Minimal
As the number of partitioned keys grows, management becomes more complex.
How to Track Key Inventory
A policy is required to retire unused keys. Identify keys older than a certain period; if no data remains encrypted with a specific key, flag it for deletion and perform periodic cleanup.
If you are just starting, we recommend Time-based Partitioning (Monthly). As your service scales and data sensitivity increases, you can enhance security by additionally applying Hash-based Partitioning.
Step-by-Step Configuration

Caution
Beyond automatic rotation, immediate manual rotation is required in the following scenarios.
Caution
If a plaintext DEK is leaked at the memory or application level, key rotation alone is insufficient. Since data encrypted with the leaked plaintext key can still be decrypted, you must perform a full data re-encryption.


You can verify changes after a key rotation through the API.
curl -X GET \
'https://api-keymanager.nhncloudservice.com/keymanager/v1.2/appkey/{appkey}/keystores/{keyStoreId}/keys/{keyId}' \
-H 'X-TC-AUTHENTICATION-ID: {User Access Key ID}' \
-H 'X-TC-AUTHENTICATION-SECRET: {Secret Access Key}'
Response Example
{
"header": {
"resultCode": 0,
"resultMessage": "success",
"isSuccessful": true
},
"body": {
"keyId": "035a0ffa16a64bbf8171c4bdcea37bbf",
...Omitted...
"currentKeyValueVersion": 2,
"autoRotationPeriod": 0,
"nextAutoRotationDate": null,
...Remainder Omitted...
}
}
If you are currently using a Secure Key Manager symmetric key for Direct Data Encryption, you must migrate to Envelope Encryption before applying key rotation.
User Data → Direct Encryption with Secure Key Manager Symmetric Key → Storage of Encrypted Data
Applying key rotation in this state will lead to the following issues:
Method 1: Migration to Envelope Encryption (Recommended)
Method 2: Maintaining Current Structure (Not Recommended)
If you apply key rotation while maintaining single-key encryption, the following issues will occur:
Please verify the following items before applying key rotation:
Caution
Before applying key rotation to a production environment, you must validate the entire scenario in a test environment. A single mistake can lead to a critical system failure.
To meet increasing security requirements, this guide has introduced two strategies for strengthening security using Secure Key Manager’s key rotation feature. Depending on your service environment and data characteristics, these can be applied as either mandatory or optional.
Envelope Encryption is the foundational pattern for key rotation. It makes rotation significantly easier compared to direct single-key encryption and eliminates the need to re-encrypt massive datasets. We strongly recommend implementing Envelope Encryption from the initial system design phase.
Key partitioning is a strategy to take security to the next level. However, since it increases management complexity, it can be applied selectively based on service characteristics.
Properly utilizing Secure Key Manager’s key rotation feature provides the following benefits:
Key rotation is a continuous security process, not a one-time task. By selecting a strategy tailored to your service scale and security needs—and through regular reviews and improvements—you can steadily elevate your security standards.