Skip to content

Feature/tls password support#205

Merged
jmartin82 merged 5 commits intomasterfrom
feature/tls-password-support
Jun 17, 2025
Merged

Feature/tls password support#205
jmartin82 merged 5 commits intomasterfrom
feature/tls-password-support

Conversation

@jmartin82
Copy link
Copy Markdown
Owner

Summary

Changes Made

  • ✅ Added --tls-key-password command line flag
  • ✅ Added MMOCK_TLS_KEY_PASSWORD environment variable support
  • ✅ Created helper function to load encrypted private keys
  • ✅ Added support for multiple key formats (PKCS#1, PKCS#8, EC)
  • ✅ Maintained backward compatibility with unencrypted keys
  • ✅ Added comprehensive test coverage

Usage Examples

```bash

Using command line flag

mmock --tls-key-password mypassword

Using environment variable (recommended for containers)

MMOCK_TLS_KEY_PASSWORD=mypassword mmock

Existing unencrypted keys work unchanged

mmock
```

Test Plan

  • Unit tests for encrypted and unencrypted key loading
  • All existing tests continue to pass
  • Help output displays new flag correctly
  • Code compiles without errors

jmartin82 and others added 5 commits June 12, 2025 09:08
Change from pointer receiver to value receiver to fix compilation error
in mapping.go where mock.Validate() is called on a value type.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Resolves #116

This feature allows mmock to work with encrypted TLS private key files
by adding support for password authentication.

Features added:
- New --tls-key-password command line flag for specifying key password
- Environment variable MMOCK_TLS_KEY_PASSWORD for secure password input
- Automatic fallback to standard loading for unencrypted keys
- Support for multiple private key formats (PKCS#1, PKCS#8, EC)
- Comprehensive error handling with descriptive messages

Usage examples:
  mmock --tls-key-password mypassword
  MMOCK_TLS_KEY_PASSWORD=mypassword mmock

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@jmartin82 jmartin82 merged commit d5b6122 into master Jun 17, 2025
1 check passed
@jmartin82 jmartin82 deleted the feature/tls-password-support branch June 17, 2025 14:53
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.

Password protected TLS key file

1 participant