Skip to content

feat: Enhanced the sealed Secret flg - #156

Open
Rohit-Singh43-1 wants to merge 3 commits into
ibm-hyper-protect:mainfrom
Rohit-Singh43-1:Feature/SealedSecretEnhancement
Open

feat: Enhanced the sealed Secret flg#156
Rohit-Singh43-1 wants to merge 3 commits into
ibm-hyper-protect:mainfrom
Rohit-Singh43-1:Feature/SealedSecretEnhancement

Conversation

@Rohit-Singh43-1

Copy link
Copy Markdown
Member

Description

Enhanced the sealed Secret Flag, To support multiple files creation for output.

When --out is provided (e.g. --out sealed_secret.txt), three separate files are created:

File Contents
sealed_secret_SealedValue.txt Sealed secret value (for use in the contract)
sealed_secret_DecryptionKey.txt RSA private key for decryption — keep this secure
sealed_secret_VerificationKey.txt RSA public key for signature verification

Related Issue

Fixes #

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code refactor (no functional changes)
  • CI/CD or build changes

Target Platform

  • HPVS (IBM Hyper Protect Virtual Servers for VPC)
  • CCRT (IBM Confidential Computing Container Runtime)
  • CCRV (IBM Confidential Computing Container Runtime for Red Hat Virtualization Solutions)
  • CCCO (IBM Confidential Computing Containers for Red Hat OpenShift Container Platform)
  • All platforms
  • Not platform-specific

Testing

  • make test passes
  • make fmt applied (no formatting changes needed)
  • New tests added for new functionality (if applicable)

Checklist

  • My code follows the project's coding standards
  • I have performed a self-review of my code
  • I have added/updated GoDoc comments for public functions
  • I have updated documentation (README, docs/README.md) if needed
  • All new and existing tests pass (make test)
  • I have verified there are no breaking changes (or documented them above)

Supporting different files ceration for sealed secret output
@vikas-sharma24

Copy link
Copy Markdown
Member

@Rohit-Singh43-1 could you add some examples of the updated command?
Also it now generates three output files. Can we introduce a separate flag to control this behavior?

Comment thread lib/sealedSecret/sealedSecret.go Outdated
fmt.Printf("Verification key written to: %s\n", verificationKeyPath)
} else {
// Print to stdout if no output path specified
output := fmt.Sprintf("Sealed Secret:\n%s\n\nSECRET_DECRYPTION_KEY=%s\n\nSECRET_VERIFICATION_KEY=%s",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a suggestion can we go with some other format (example json).
Is this is easy to read if we print all 3 values?

@Rohit-Singh43-1

Copy link
Copy Markdown
Member Author

`./contract-cli-s390x --help
Contract CLI automates contract generation and management for IBM Confidential Computing services.

Supports:

  • IBM Confidential Computing Container Runtime
  • IBM Confidential Computing Container Runtime for Red Hat Virtualization Solutions
  • IBM Confidential Computing Containers for Red Hat OpenShift Container Platform

Documentation: https://ibm-hyper-protect.github.io/contract-cli/

Usage:
contract-cli [flags]
contract-cli [command]

Available Commands:
base64 Encode input as Base64
base64-tgz Create Base64 tar archive of container configurations
contract-template Generate a contract template
decrypt-attestation Decrypt encrypted attestation records
download-certificate Download encryption certificates
encrypt Generate signed and encrypted contract
encrypt-string Encrypt string in IBM Confidential Computing format
get-certificate Extract specific certificate version from download output
help Help about any command
image Get IBM Confidential Computing Container Runtime image details from IBM Cloud
initdata Gzip and Encoded initdata annotation
list-encryptioncert-versions List available encryption certificate versions
sealed-secret Generate sealed secret for CCCO
sign-contract Sign an encrypted contract
validate-contract Validate contract schema
validate-encryption-certificate Validate encryption certificate
validate-network Validate network configuration schema

Flags:
-h, --help help for contract-cli
-v, --version version for contract-cli

Use "contract-cli [command] --help" for more information about a command.
[root@mystack1 test_sealed]# ./contract-cli-s390x sealed-secret --help
Usage:
contract-cli sealed-secret [flags]

Mandatory Flags:
--in Secret for sealing (provide as string or file path, use '-' for standard input)
--type Type of secret: 'env' for env section of contract or 'workload' for workload section of contract

Optional Flags:
--encryptionkey Path to RSA private key for encryption (optional, generates new key if not provided)
--help help for sealed-secret
--out Path to save sealed secret output (optional, prints to stdout if not specified)
--signingkey Path to RSA private key for signing (optional, generates new key if not provided)
./contract-cli-s390x sealed-secret --in rohit --type env
{
"sealed_secret": "sealed.eyJhbGciOiJSUzUxMiIsImtpZCI6ImVudl92ZX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-----END PUBLIC KEY-----\n"
}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants