Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

email decrypt ? #306

Open
rpeveri opened this issue Sep 10, 2021 · 2 comments
Open

email decrypt ? #306

rpeveri opened this issue Sep 10, 2021 · 2 comments

Comments

@rpeveri
Copy link

rpeveri commented Sep 10, 2021

good afternoon,
I want to export all the mails that are in mysql of the people who commented and I can not see them because they appear encrypted or something similar.
The idea is to make a marketing campaign and this problem is not allowing me to do it.
I hope someone can help me.
Thanks for your help.

@rpeveri
Copy link
Author

rpeveri commented Sep 10, 2021

and on the other hand googlebot can index the content of the comments encrypted with base64 ?

@da2x
Copy link
Contributor

da2x commented Dec 2, 2021

The idea is to make a marketing campaign and this problem is not allowing me to do it.

Good. Neither the GDPR nor other international privacy regulations allow you do to it either. You can’t send people newsletters and junk unless they’ve expressly opted-in to receiving it.

Here’s the decryption function:

// Decrypt OpenSSL encrypted string
public function decrypt ($string, $keys)
{
// Return false if string or keys is empty
if (empty ($string) or empty ($keys)) {
return false;
}
// Initial key
$decryption_key = '';
// Split keys string into array
$keys = explode (',', $keys);
// Retrieve random key from array
foreach ($keys as $value) {
// Cast key to integer
$hash_key = (int)($value);
// Check if encryption hash key exists
if (isset ($this->encryptionHash[$hash_key])) {
// If so, add character to decryption key
$decryption_key .= $this->encryptionHash[$hash_key];
} else {
// If not, give up and return false
return false;
}
}
// Decode base64 encoded string
$decoded = base64_decode ($string, true);
// Get length of decoded string
$length = mb_strlen ($decoded, '8bit');
// Get decipher text from decoded string
$decrypted = mb_substr ($decoded, $this->ivSize, $length, '8bit');
// Setup OpenSSL IV
$iv = mb_substr ($decoded, 0, $this->ivSize, '8bit');
// Return OpenSSL decrypted string
return openssl_decrypt (
// String being decrypted
$decrypted,
// Encryption decipher method
$this->cipher,
// Retrieved decryption key
$decryption_key,
// OpenSSL options
$this->options,
// Initialization vector
$iv
);
}

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

No branches or pull requests

2 participants