While declaring real Authors, Sections, and Tags might be a good recommendation from an SEO and EAT perspective, there might be strategic situations where you don’t want to openly expose these values but you still want to be able to track them on Marfeel.
For these situations, Marfeel supports encrypted Authors, Sections, and Tags. When declared as encrypted, the real values will only be visible by Marfeel.
How to Encrypt Values
Publishers can encrypt values using an asymmetric RSA cipher. You can encrypt your text using Public-Key Cryptography Standards(PKCS) with the Padding Scheme Optimal Asymmetric Encryption Padding(OAEP) and transform the result into a base64 string. More info.
Marfeel Public RSA Key
Publishers can encrypt the values with the Public RSA Marfeel Key:
-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA3TXGyYwHoNN1erI/UKPDudVAQhSV+mguc0aYjMWXj6ck98gSP/8Kaum/etDqkkLFhE075T+PH4zkNUsAgT+ZhnzbCQQJKGSWQa5oJEuokX+tD+x2kyvnGZtJQboIDhBU1h3MEgQlkXZmbiBNm0gobX0Hw9CoZHk0NPbjSP19PQFMF0gvVJKLp24MFjSzsS6R27H0a88HmChy0fiO5ClrBDKCAek5d/ZA5tVzV7X1ERqGYTHY912vM9/M4GggdrJycZrvKq9ZZF6FiccQfEOoWBvMcPhYXEle+D+5rjepryvCsChXcouwCfI2gWTkjFrQhzPHoriUiQ485UEebbk2T+JC3hsT3uZl2PjnQb5l6PAG+M33FVai1hCp39YNny6X1a+vE3wW9K8g6mJO7B4s4Lx/Pa45Epmd4vajMqskKKWCXumg7Yoru+steI8M7jn39NJ+gmzpmaOR0NDrxDlZfK5zG5D0cL//wB9f1WnpkYBvxVKS2V/O02UQU9c/w9tls9uHFJWnIOSKLA81xSX1LdkcdVTa5SAPll/RsRiyAJAnYYiM95t/dmFEYAK9NPw43wbu8+7NiQLQYxwV8/mDhRZkLw35xc0YxTkwxZjBYah8AFWmYS3nXhe0O3WvIkH/h6TR5DZLh4omic8U4YRorGLFmRav31PCT0YZFg3P/o0CAwEAAQ==
-----END PUBLIC KEY-----
How Encryption Works
Marfeel will extract all the information before ## as the data.
Cipher Code Examples
Here’s a cipher example in PHP:
public function encrypt(string $data): string
{
$oOpenSSLAsymmetricKey = openssl_get_publickey($this->publicKey);
if (openssl_public_encrypt($data, $encrypted, $oOpenSSLAsymmetricKey, OPENSSL_PKCS1_OAEP_PADDING)) {
$data = base64_encode($encrypted);
} else {
throw new \Exception('Unable to encrypt data');
}
return $data;
}
Here’s a cipher example in Node:
const NodeRSA = require('node-rsa');
const encrypt = async (data) => {
const clientKey = new NodeRSA(RSA_PUBLIC_KEY);
clientKey.setOptions({encryptionScheme: 'pkcs1_oaep'});
return clientKey.encrypt(data, 'base64');
};
Here’s a cipher example in Python:
from cryptography.hazmat.primitives.asymmetric import padding, rsa
from cryptography.hazmat.primitives import serialization, hashes
import base64
def encrypt_rsa(public_key_pem: str, data: str) -> str:
public_key = serialization.load_pem_public_key(public_key_pem.encode())
encrypted = public_key.encrypt(
data.encode(),
padding.OAEP(
mgf=padding.MGF1(algorithm=hashes.SHA1()),
algorithm=hashes.SHA1(),
label=None
)
)
return base64.b64encode(encrypted).decode()
Encrypting Authors
Declaration
The mrf:authors meta can specify encrypted="true":
<meta property="mrf:authors" encrypted="true" content="AiqpEJ+VdfIm9dlXeRND6RD+IdMBF=" >
Example
To encrypt an article with authors John Doe and Fred Doe:
Non-encrypted:
<meta property="mrf:authors" content="John Doe;Fred Doe">
Encrypted:
<meta property="mrf:authors" encrypted="true" content="theOutputOfEncrypting(John Doe;Fred Doe##randomdata)">
Encrypting Sections
Declaration
The mrf:sections meta can specify encrypted="true":
<meta property="mrf:sections" encrypted="true" content="AiqpEJ+VdfIm9dlXeRND6RD+IdMBF=" >
Example
To encrypt an article with sections Politics and Economy:
Non-encrypted:
<meta property="mrf:sections" content="Politics;Economy">
Encrypted:
<meta property="mrf:sections" encrypted="true" content="theOutputOfEncrypting(Politics;Economy##randomdata)">
Encrypting Tags
Declaration
The mrf:tags meta can specify encrypted="true":
<meta property="mrf:tags" encrypted="true" content="AiqpEJ+VdfIm9dlXeRND6RD+IdMBF=" >
Example
To encrypt an article with tags:
Non-encrypted:
<meta property="mrf:tags" content="tagGroup1:tag_name;tagGroup2:another_tag_name">
Encrypted:
<meta property="mrf:tags" encrypted="true" content="theOutputOfEncrypting(tagGroup1:tag_name;tagGroup2:another_tag_name##randomdata)">
Combining Encrypted and Non-Encrypted Tags
Tags support a combination of encrypted and non-encrypted meta tags on the same article:
<meta property="mrf:tags" content="publicGroup:public_tag;anotherGroup:visible_tag" />
<meta property="mrf:tags" encrypted="true" content="theOutputOfEncrypting(privateGroup:private_tag##randomdata)" />