Skip to content

Refactor RSAParameters to Remove Passphrase Property for Enhanced Security #24

@MayMeow

Description

@MayMeow

Description:

Currently, the RSAParameters class stores the passphrase as a private property:

private ?string $passphrase = 'test_passphrase';

Storing the passphrase in memory as part of the object can be a security risk, especially if the object persists longer than necessary or is accidentally exposed. A more secure approach is to require the user to provide the passphrase each time the private key is accessed or decrypted, rather than storing it in the class.

Tasks:

  • Remove the $passphrase property from RSAParameters.
  • Refactor all methods that use $this->passphrase to accept the passphrase as a method argument instead.
  • Update the constructor, setters, and any related code to no longer store the passphrase.
  • Update documentation and usage examples to reflect this change.
  • Add tests to ensure that the new approach works as expected and does not break existing functionality.

Benefits:

  • Reduces the risk of passphrase leakage.
  • Follows best practices for sensitive data handling.
  • Makes the library safer for use in security-critical applications.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions