This guide covers the IBM Key Protect / Hyper Protect Crypto Services integration for TrustWeave. The IBM KMS plugin provides production-ready key management with FIPS 140-3 Level 4 compliance and support for all IBM Key Protect-compatible algorithms.
Overview
The kms/plugins/ibm module provides a complete implementation of TrustWeave’s KeyManagementService interface using IBM Key Protect or Hyper Protect Crypto Services. This integration enables you to:
Use IBM Key Protect for secure key generation and storage with FIPS 140-3 Level 4 validated HSMs
Support all IBM Key Protect-compatible algorithms (Ed25519, secp256k1, P-256/P-384/P-521, RSA)
Integrate with existing IBM Cloud infrastructure and IAM policies
Meet regulatory compliance requirements with FIPS-validated cryptographic operations
Installation
Add the IBM Key Protect module to your dependencies:
1
2
3
4
dependencies{// Only need to add the IBM Key Protect KMS plugin - core dependencies are included transitivelyimplementation("org.trustweave.kms:ibm:1.0.0-SNAPSHOT")}
Note: The IBM Key Protect KMS plugin automatically includes trustweave-kms and trustweave-common as transitive dependencies, so you don’t need to declare them explicitly.
valconfig=IbmKmsConfig.fromEnvironment()valkms=IbmKeyManagementService(config?:throwIllegalStateException("Config not found"))
SPI Auto-Discovery
The plugin registers itself via Java ServiceLoader:
1
2
3
4
5
6
7
8
9
importorg.trustweave.kms.*// Simple factory API - no ServiceLoader needed!valkms=KeyManagementServices.create("ibm",mapOf("apiKey"to"your-api-key","instanceId"to"your-instance-id","region"to"us-south",// Optional, default is "us-south""serviceUrl"to"https://us-south.kms.cloud.ibm.com"// Optional))
Supported Algorithms
Algorithm
IBM Key Type
Notes
Ed25519
Ed25519
Standard
secp256k1
secp256k1
Blockchain-compatible
P-256
EC:secp256r1
Standard
P-384
EC:secp384r1
Standard
P-521
EC:secp521r1
Standard
RSA-2048
RSA-2048
⚠️ Legacy (deprecated)
RSA-3072
RSA-3072
Recommended
RSA-4096
RSA-4096
High security
Note: RSA-2048 is deprecated. Use RSA-3072 or RSA-4096 for new deployments.
valdeleteResult=kms.deleteKey(keyId)when(deleteResult){isDeleteKeyResult.Deleted->println("Key deleted")isDeleteKeyResult.NotFound->println("Key not found (already deleted)")isDeleteKeyResult.Failure.Error->println("Error: ${deleteResult.reason}")}
Key ID Format
IBM Key Protect uses CRN (Cloud Resource Name) format for key IDs:
1
crn:v1:bluemix:public:kms:us-south:a/xxx:key:xxx
The plugin handles both full CRN and short key ID formats.