Open adaniloff opened 3 years ago
Hi!
Why not adding an interface to the RSA class ? I'm thinking about using your solution but I'd like having an interface for DI and SOLID purposes...
In fact, i'd like to be able to make an adapter to your class.
Just a suggestion:
<?php namespace Pikirasa;
interface RSAInterface { /*
Minimum key size bits */ const MINIMUM_KEY_SIZE = 128;
/*
Default key size bits */ const DEFAULT_KEY_SIZE = 2048;
public function fixKeyArgument($keyFile);
/**
@throws Pikirasa\Exception */ public function create($keySize = null, $overwrite = false);
@return string Certificate public key string or stream path */ public function getPublicKeyFile();
@return string Certificate private key string or stream path */ public function getPrivateKeyFile();
@param string $password Certificate password */ public function setPassword($password);
@throws Pikirasa\Exception */ public function encrypt($data);
@return string Base64-encrypted data */ public function base64Encrypt($data);
@throws Pikirasa\Exception */ public function decrypt($data);
- Update the RSA class with the interface impl: ```php <?php namespace Pikirasa;
class RSA implements RSAInterface { // ... you can keep the same code and even use @inheritDoc to use the interface's annotations }
Hi!
Why not adding an interface to the RSA class ? I'm thinking about using your solution but I'd like having an interface for DI and SOLID purposes...
In fact, i'd like to be able to make an adapter to your class.
Just a suggestion:
interface RSAInterface { /*
Minimum key size bits */ const MINIMUM_KEY_SIZE = 128;
/*
Default key size bits */ const DEFAULT_KEY_SIZE = 2048;
public function fixKeyArgument($keyFile);
/**
@throws Pikirasa\Exception */ public function create($keySize = null, $overwrite = false);
/**
@return string Certificate public key string or stream path */ public function getPublicKeyFile();
/**
@return string Certificate private key string or stream path */ public function getPrivateKeyFile();
/**
@param string $password Certificate password */ public function setPassword($password);
/**
@throws Pikirasa\Exception */ public function encrypt($data);
/**
@return string Base64-encrypted data */ public function base64Encrypt($data);
/**
@throws Pikirasa\Exception */ public function decrypt($data);
/**
class RSA implements RSAInterface { // ... you can keep the same code and even use @inheritDoc to use the interface's annotations }