Skip to content

Conversation

@jeffallen
Copy link
Owner

  • Fix notification-backend RSA private key parsing error in loadPrivateKey()
    • Replace single x509.ParsePKCS1PrivateKey() call with dual-format support
    • Try PKCS#1 format first (legacy "-----BEGIN RSA PRIVATE KEY-----" headers)
    • Fall back to PKCS#8 format for modern OpenSSL-generated keys ("-----BEGIN PRIVATE KEY-----")
    • Add proper error handling with descriptive messages for both format attempts
    • Validate parsed key is actually RSA type when using PKCS#8 parsing
  • Resolve "use ParsePKCS8PrivateKey instead for this key format" error
    • Modern OpenSSL genrsa command generates PKCS#8 format by default
    • Previous code only supported legacy PKCS#1 format causing parse failures
    • New implementation maintains backward compatibility with existing PKCS#1 keys
  • Generate new 4096-bit RSA key pair for consistent cryptographic security
    • Update root public_key.pem with new public key for app-backend usage
    • Update demo-app/app/src/main/assets/public_key.pem for Android encryption
    • Keys generated using standard OpenSSL commands per README instructions
  • Test successful notification-backend startup with both key formats
    • Firebase service account key (key.json) parsing already working correctly
    • RSA private key parsing now successful: "RSA private key loaded successfully"
    • Public key hash computation working: "Public key hash computed"
    • Server starts successfully on port 8080 with all endpoints active
  • Maintain complete backward compatibility with existing PKCS#1 keys
  • Fix resolves startup failure preventing notification-backend from functioning

Change-ID: s17cd5b682d740ba5k

- Fix notification-backend RSA private key parsing error in loadPrivateKey()
  - Replace single x509.ParsePKCS1PrivateKey() call with dual-format support
  - Try PKCS#1 format first (legacy "-----BEGIN RSA PRIVATE KEY-----" headers)
  - Fall back to PKCS#8 format for modern OpenSSL-generated keys ("-----BEGIN PRIVATE KEY-----")
  - Add proper error handling with descriptive messages for both format attempts
  - Validate parsed key is actually RSA type when using PKCS#8 parsing
- Resolve "use ParsePKCS8PrivateKey instead for this key format" error
  - Modern OpenSSL genrsa command generates PKCS#8 format by default
  - Previous code only supported legacy PKCS#1 format causing parse failures
  - New implementation maintains backward compatibility with existing PKCS#1 keys
- Generate new 4096-bit RSA key pair for consistent cryptographic security
  - Update root public_key.pem with new public key for app-backend usage
  - Update demo-app/app/src/main/assets/public_key.pem for Android encryption
  - Keys generated using standard OpenSSL commands per README instructions
- Test successful notification-backend startup with both key formats
  - Firebase service account key (key.json) parsing already working correctly
  - RSA private key parsing now successful: "RSA private key loaded successfully"
  - Public key hash computation working: "Public key hash computed"
  - Server starts successfully on port 8080 with all endpoints active
- Maintain complete backward compatibility with existing PKCS#1 keys
- Fix resolves startup failure preventing notification-backend from functioning

Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: s17cd5b682d740ba5k
@jeffallen jeffallen merged commit 98198cd into main Jul 24, 2025
3 checks passed
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