RsaWalletServiceInterface
interface RsaWalletServiceInterface (View source)
RSA related service functions (e.g. used for the RSA authentication provider)
Methods
Generates a new keypair and returns a fingerprint to refer to it
Adds the specified keypair to the local store and returns a fingerprint to refer to it.
Adds the specified public key to the wallet and returns a fingerprint to refer to it.
Returns the public key for the given fingerprint
Decrypts the given cypher with the private key identified by the given fingerprint Note: You should never decrypt a password with this function. Use checkRSAEncryptedPassword() to check passwords!
Signs the given plaintext with the private key identified by the given fingerprint
Checks whether the given signature is valid for the given plaintext with the public key identified by the given fingerprint
Encrypts the given plaintext with the public key identified by the given fingerprint
Checks if the given encrypted password is correct by comparing it's md5 hash. The salt is appended to the decrypted password string before hashing.
Destroys the keypair identified by the given fingerprint
Details
string
generateNewKeypair(bool $usedForPasswords = false)
Generates a new keypair and returns a fingerprint to refer to it
string
registerKeyPairFromPrivateKeyString(string $privateKeyString, bool $usedForPasswords = false)
Adds the specified keypair to the local store and returns a fingerprint to refer to it.
string
registerPublicKeyFromString(string $publicKeyString)
Adds the specified public key to the wallet and returns a fingerprint to refer to it.
This is helpful if you have not private key and want to use this key only to verify incoming data.
OpenSslRsaKey
getPublicKey(string $fingerprint)
Returns the public key for the given fingerprint
string
decrypt(string $cypher, string $fingerprint)
Decrypts the given cypher with the private key identified by the given fingerprint Note: You should never decrypt a password with this function. Use checkRSAEncryptedPassword() to check passwords!
string
sign(string $plaintext, string $fingerprint)
Signs the given plaintext with the private key identified by the given fingerprint
bool
verifySignature(string $plaintext, string $signature, string $fingerprint)
Checks whether the given signature is valid for the given plaintext with the public key identified by the given fingerprint
string
encryptWithPublicKey(string $plaintext, string $fingerprint)
Encrypts the given plaintext with the public key identified by the given fingerprint
bool
checkRSAEncryptedPassword(string $encryptedPassword, string $passwordHash, string $salt, string $fingerprint)
Checks if the given encrypted password is correct by comparing it's md5 hash. The salt is appended to the decrypted password string before hashing.
void
destroyKeypair(string $fingerprint)
Destroys the keypair identified by the given fingerprint