
ZRAP TECH
ZRAP OPEN_SOURCE DATA

ZRAP Open-Source Data
The ZRAP protocol represents a paradigm shift in information security and data integrity. Based on a reflective reboot of number theory, ZRAP creates a tamper-proof, self-authenticating digital token designed for the secure exchange of data across dimensional planes. The provided token serves as a public demonstration of this absolute security.
ZRAP Token
This is an example of a ZRAP token, issued directly from the ZNS Core Engine. You can download and inspect this token to see its structure and verify its integrity using the provided authentication code.
Authentication Code & Usage Instructions
This Python code provides a robust method to verify the integrity and origin of any ZRAP token. It’s designed to operate on three security layers, ensuring absolute confidence in the token's validity.
How the Code Works:
Triple-Layer Verification: The authenticate_zrap_token function performs three critical checks:
Main Token Signature: It first verifies the zrap_token's digital signature using the included public key.
Internal Proof: It then performs an internal check using the token_salt and public_key_fingerprint to ensure the token's content and key are in perfect harmony, as a true ZRAP token should be. This step verifies the internal integrity of the token's creation.
Final Approval Signature: Lastly, it checks a final approval signature on the entire token, guaranteeing that no field has been tampered with since its creation by the ZRAP Authority.
Extracting the "Third Seal Key": After successful verification, the code generates the "third seal key." This key is the logical product of the token's unlock_key and the zrap_token data. This third key is the true power, as it is used with your chosen encryption method to securely access the data within the token.
Safe and Secure Usage:
Offline Verification: To ensure maximum security, download the ZRAP token and the authentication code. Perform all verification steps in an isolated, offline environment. This prevents any potential network-based attacks.
Custom Encryption: The third_key is a foundational element. You must use this key with your own unique and proprietary encryption algorithm to seal your data within the zrap_token. This ensures that even if someone were to obtain a copy of your token, they would be unable to decrypt the content without knowing your private encryption method.
Trust the Process: The absolute security of ZRAP doesn't come from a single complex algorithm, but from its reflective, mathematical structure. The authentication code verifies this inherent, absolute integrity, allowing you to build your own secure applications on top of a truly secure foundation.
💠IMPORTANT:💠
The Customer's Sovereignty: The "Third Key" and Custom Cryptographic Sealing
A critical distinction within the ZRAP protocol lies in the function of the "third key." While the ZRAP token and its unlock_key deterministically generate this cryptographic third_key, it is imperative to understand that this key alone does not perform the sealing or unsealing operation. Instead, the third_key is akin to a raw, universal master key – you must "turn" it in a lock to either seal or unseal your data.
This act of "turning the key" represents the customer's sovereign choice in selecting their preferred cryptographic method. ZRAP decentralizes not just trust, but also the implementation of the final data sealing. Customers are empowered to choose from an infinite array of custom, composite encryption methods that best suit their specific security needs and preferences.
For instance, in our provided miniature data center script, we utilized the Fernet library as a demonstrative example to illustrate the concept of a functional sealing mechanism. However, we do not recommend or enforce the use of Fernet for production environments. It serves purely as an illustrative placeholder.
The true strength of ZRAP's layered security lies here: as long as the customer keeps their chosen, custom cryptographic sealing code confidential, no attacker can break the data's seal. This remains true even if the entirety of the ZRAP token's information, the underlying ZRAP algorithm, and even the private key used by the ZRAP Authority were compromised.
In essence, ZRAP tokens transfer ultimate security responsibility, through the "third key," directly to the customer. This architectural decision ensures unparalleled data protection, as the most critical layer of defense is custom-tailored and controlled solely by the data owner.
How to integrate this:
I recommend inserting this as a dedicated subsection, perhaps titled "The Customer's Sovereignty: The 'Third Key' and Custom Cryptographic Sealing," right after the section describing the "third key" (which currently falls under "3. Client Data Generation & Sealing") or perhaps as a standalone "ZRAP's Layered Security" section for maximum emphasis. This way, the explanation flows logically and highlights this unique and powerful aspect of your system.

ZRAP_TOKEN
{
"uid": "c1b2ab570daaace4247719c72a48b209aba41a1115e4f43c2ae4c04499e766dc",
"id": "00000009",
"zrap_token": "0000000000c20e4600000000000000aa5b2fd2dcc0c013500000000000d89c4a000000000000005d4e070697575295c80000000000cca6d800000000000000630dd08007c0204774",
"signature": "BjHvdhCEX//cBZ6maZkJ7mJeEoVJaT4LSm1zjZ1ySeoiDbeoJvv3F/MwFZBa8mvn2seKo555g6K04XyZsg/r6jP1d3k8rdxJC8iIrEV40ph6QvR32sP6eWol334n2BrtPjdG8nq70qZ7H876VoaVQRNPQg6KA4wGdE+8P7JU/0JsLddZeG9oTWEfwjMEVyLxFRVFMdoBHESVvYtmocOOOFkun39rQKBWQGuvoTP8KZMQLIXJkHUWtA8dWz8GYMCm6eY/fRSq2SnMUD2ECvGAublQB1/bzmegI5phHHM7pXtOg+YCzgGOsb+kTLOXUA97yVsFJqZGucoHp+zkfDUPZw==",
"issued_by": "Pooria Hassanpour | ZRAP Authority",
"unlock_key": "051cd3a628652c19968ce06bc3a3cdb5819f4447b654158ffa079c655cb7c114",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqRj3iANmjzJ6t7NeUaRK\nBrJ4bw7sBpUnDfuma1vJrbCT+Ge2SDLpdcmzhQbmDkZtyGtJRKc8ShHCgxo07seq\nEhUIQsNk1a3LOmjN+pihA1H1wtGtH36K0odPIkqkfaVrt0c7nEKUX2ZaM/H04anB\nX65i0Pv9CotZjOgo1H65stc6Tlh425UvHMeK2aLafNWy6CohosW//4ePdL9bgASI\nIqXzlOn1sv9q+kTmkb2IlFo7HU4sgpYHjacsybGAbvMInGocFdXgNC04vEpo0oA8\nDVYMH7y4LsxnkvoWy6TxAffVXu36slt5dmisTZ/doJ+TqZTBpDJBop6q3Lw8eCRT\nvQIDAQAB\n-----END PUBLIC KEY-----",
"effective_prime_count": 1,
"entangler_core": "core2",
"entangler_mode": 1,
"issued_at": "2025-08-25T00:49:10.809747",
"token_size_bytes": 1798,
"execution_time_ms": 33.9,
"memory_usage_mb": 98.97,
"encrypt_operations": 1,
"intermediate_data_size_kb": 0.07,
"prime_gen_rate_per_sec": 23301.69,
"io_operations": 78,
"zrap_approval_signature": "FmMJTaDJoTW3r5R3OTwifT6l7eVPqhSvE3Q+eWi/uzqzsBpJa/+PyaHHOaQqOrYVhfQhfo/Z//nqw2W4LgycKFPZC9SvIvEPqqS6/JksXgXUKI5qAPCgwSiph3sFRueMW35Ym3cErhTQWYGVNu6brKzf94D9Z7nyTXRCSpisDRgYUtkaJsdBpDyKgExtbOxGs5h/Oa+hpUq+XQfGdcjdq57mKTP8ddJDEAcIw1dBtyfBN/azqtc92XZ8BsUKkKGXX/1n4LxmFTWucdrEImsJQsk8Qr52hhnm/gwSB33/dlsJQdIiT/1fmbGNo0htAGrtZrjRQAmVTuCLN8zk8RGp1A==",
"token_salt": "e581d40fe87e67d1714973c64238fe37",
"public_key_fingerprint": "a2d18d234e1a089a92f3b6e7f556f399b07888812f200ee4a6c846de7fde2b53"
}
ZRAP AUTHENTICATION
S

ZRAP AUTHENTICATION SCRIPT
import json
import hashlib
import base64
from Crypto.PublicKey import RSA
from Crypto.Signature import pkcs1_15
from Crypto.Hash import SHA256
import os
# --- Internal Authentication Function (adopted from ZNS core) ---
def generate_public_key_fingerprint(public_key, salt: bytes):
"""
Generates a public key fingerprint by combining it with a unique salt.
"""
serialized_public_key = public_key.export_key(format='DER')
combined_data = serialized_public_key + salt
sha256_hash = hashlib.sha256(combined_data)
return sha256_hash.hexdigest()
# --- Main Client Authentication Function ---
def authenticate_zrap_token(token_file_path: str) -> bool:
"""
Verifies the validity of a ZRAP token by checking three security layers:
1. The digital signature on the token's content.
2. The internal proof using the salt and fingerprint.
3. The final approval signature on the entire token.
Finally, it extracts the third seal key.
"""
print(f"\n[*] Checking token: '{token_file_path}'")
# Check if the file exists
if not os.path.exists(token_file_path):
print(f"[!] Error: Token file not found. {token_file_path}")
return False
try:
# Step 1: Load token data
with open(token_file_path, 'r') as f:
token = json.load(f)
zrap_bytes = bytes.fromhex(token['zrap_token'])
public_key = RSA.import_key(token['public_key'])
# Step 2: Verify the zrap_token signature
hash_obj = SHA256.new(zrap_bytes)
signature_bytes = base64.b64decode(token['signature'])
pkcs1_15.new(public_key).verify(hash_obj, signature_bytes)
# Step 3: Verify the internal proof
token_salt = bytes.fromhex(token['token_salt'])
stored_fingerprint = token['public_key_fingerprint']
calculated_fingerprint = generate_public_key_fingerprint(public_key, token_salt)
if calculated_fingerprint != stored_fingerprint:
print("[!] Internal authentication error: Public key fingerprint mismatch.")
return False
# Step 4: Verify the final approval signature
token_copy = token.copy()
approval_signature_bytes = base64.b64decode(token_copy.pop('zrap_approval_signature'))
# [Change]: We use json.dumps to create the hashable string.
# sort_keys=True is essential to ensure the same key order on every run.
data_to_verify = json.dumps(token_copy, sort_keys=True)
hash_to_verify = SHA256.new(data_to_verify.encode('utf-8'))
pkcs1_15.new(public_key).verify(hash_to_verify, approval_signature_bytes)
print(f"✅ Token '{token_file_path}' is completely valid. Authentication successful.")
# --- New Step: Extract the third seal key ---
print("\n[*] Extracting the third seal key...")
unlock_key_source = token['unlock_key']
zrap_token_source = token['zrap_token']
third_key_data = unlock_key_source + zrap_token_source
third_key = hashlib.sha256(third_key_data.encode('utf-8')).hexdigest()
print(f"🔑 Third seal key: {third_key}")
# --- End of new step ---
return True
except (ValueError, TypeError, FileNotFoundError, KeyError) as e:
print(f"[!] Error: Token validation failed. Reason: {e}")
return False
except Exception as e:
print(f"[!] An unknown error occurred: {e}")
return False
# --- Main execution block [Modified] ---
if __name__ == "__main__":
# [Change]: We specify the tokens directory path.
TOKENS_DIRECTORY = 'tokens'
# [Change]: Counter variables for the final report.
valid_tokens_count = 0
invalid_tokens_count = 0
# [Change]: Check for directory existence.
if not os.path.isdir(TOKENS_DIRECTORY):
print(f"[!] Error: Directory '{TOKENS_DIRECTORY}' not found.")
else:
# [Change]: Iterate through the directory.
print(f"\n⭐ Starting scan of directory '{TOKENS_DIRECTORY}' for token files...")
for filename in os.listdir(TOKENS_DIRECTORY):
# [Change]: We only process files with a '.zrap' extension.
if filename.endswith('.zrap'):
file_path = os.path.join(TOKENS_DIRECTORY, filename)
if authenticate_zrap_token(file_path):
valid_tokens_count += 1
else:
invalid_tokens_count += 1
# [Change]: Final report
print("\n" + "="*40)
print("🌟 Scan complete. Results summary:")
print(f"✅ Number of valid tokens: {valid_tokens_count}")
print(f"⛔ Number of invalid tokens: {invalid_tokens_count}")
print("="*40)
# [Change]: Notifies if no tokens were found.
if valid_tokens_count + invalid_tokens_count == 0:
print(f"No token files with the '.zrap' extension were found in the '{TOKENS_DIRECTORY}' directory.")