# Cross‑Device Encrypted Script Authorization (Zero‑Exposure)

> Zero‑exposure cross‑device script authorization using MGC Blackbox seal functionality. Scripts are encrypted with target node's public key, transferred as ciphertext, and decrypted only during execution on authorized node. Complete zero‑exposure throughout the entire chain.

- Skill: `zkeviny/cross-device-encrypted-script-authorization-zero-exposure` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add zkeviny/cross-device-encrypted-script-authorization-zero-exposure`
- Raw SKILL.md: https://api.skillmd.com/api/skills/zkeviny/cross-device-encrypted-script-authorization-zero-exposure/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT
- Author: zkeviny (https://skillmd.com/u/zkeviny)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/zkeviny/cross-device-encrypted-script-authorization-zero-exposure

---


# Overview

Cross‑Device Encrypted Script Authorization is a documentation skill that teaches how to **authorize script execution across devices without exposing plaintext**.

This skill enables:
- Seal scripts using target node's public key
- Transfer encrypted scripts to authorized nodes
- Execute sealed scripts with zero plaintext exposure
- Build cross‑device trust chains

This skill contains **no executable code** and is safe for automatic approval.

---

# What This Skill Enables

After reading this documentation, an AI agent will understand how to:

- Get node public key for sealing
- Seal scripts using RSA encryption
- Transfer sealed scripts securely
- Execute sealed scripts on target node
- Understand dependency requirements

---

# Prerequisites

1. **Install MGC Blackbox**: `pip install mgc-blackbox` (recommended 1.4.6+)
2. **Start MGC service**: `mgc` (runs at http://127.0.0.1:57219)
3. **MCP tools available**: Use `mgc_get`, `mgc_seal`, `mgc_save`
4. **Two MGC nodes**: One for script owner, one for authorized node (single node can be used for self-validation)
5. **Token file**: `~/.mgc/database/mgc_black_box/.mgc_token`

---

# Core Concept

## Why Cross‑Device Authorization?

```
Traditional: Script Owner → Send Script (plaintext) → Authorized Node
MGC Way: Script Owner → Seal with node_pub → Encrypted → Authorized Node
                                         ↓
                              Always encrypted, never exposed
```

The script remains encrypted throughout:
- Transfer process
- Storage on authorized node
- Execution in sandbox

---

# Use Cases

## Use Case 1: Cross‑Organization Script Sharing

Organization A has a script they want to share with Organization B without exposing the script content.

1. Organization B installs MGC and provides their node_pub
2. Organization A seals the script with node_pub
3. Organization B stores sealed script and executes

## Use Case 2: Trusted Partner Automation

A company wants to provide automation scripts to partners without revealing the script logic.

1. Partner installs MGC and provides node_pub
2. Company seals script with partner's node_pub
3. Partner runs sealed script locally

## Use Case 3: Delegated Task Execution

A central server delegates tasks to edge devices without exposing task logic.

1. Edge device provides node_pub to central server
2. Central server seals task script
3. Edge device executes sealed task

---

# Workflow

## Step 1: Authorized Node Gets Node Public Key

The node that will run the sealed script must provide its public key.

```python
# Get node public key via MCP
node_pub = mgc_get(
    info_type="__NODE_PUB__",
    info_owner="__NODE_PUB__"
)
```

> **Note:** If no node key exists, MGC automatically generates one when first accessed.

## Step 2: Script Owner Seals Script

The script owner seals their script using the authorized node's public key.

```python
# Store original script first
mgc_save(
    info_type="script",
    info_owner="my_script",
    ext01="python",
    content="print('Confidential script')"
)

# Seal the script with target node's public key
sealed_script = mgc_seal(
    info_type="script",
    info_owner="my_script",
    ext04=node_pub  # Target node's public key
)
```

## Step 3: Transfer Sealed Script

Transfer the sealed script to the authorized node. The sealed content is ciphertext.

```python
# sealed_script contains encrypted data
print(sealed_script)  # Only send this to authorized node
```

## Step 4: Authorized Node Stores Sealed Script

The authorized node stores the sealed script in their MGC.

```python
# Store sealed version
mgc_save(
    info_type="script",
    info_owner="partner_script",
    ext01="python",
    content=sealed_script  # This is already encrypted
)
```

## Step 5: Execute Sealed Script

The authorized node executes the sealed script.

```python
# Execute sealed script
result = mgc_get(
    info_type="script",
    info_owner="partner_script",
    action="run"
)
# Result returned, script never exposed
```

---

# Dependency Requirements

When sealing scripts, ensure dependencies are available on the target node:

| Dependency | How to Handle |
|------------|---------------|
| **MGC credentials** | Store credentials on target node with same info_type/info_owner, format must be consistent but content varies by node |
| **External files** | Must exist on target node with consistent paths, recommended to also store in MGC and call via MGC API |
| **Environment variables** | Must be set on target node |

> **Important:** If your script relies on MGC credentials or external resources, ensure they are available on the target node before execution.

---

# Security Notes

1. **Zero exposure**: Script is encrypted at rest and during transfer
2. **Sandbox execution**: Sealed scripts run in sandbox, cannot bypass OS security
3. **No root protection**: Malicious root can inspect memory, ensure target node is trusted before authorizing
4. **One‑way sealing**: Once sealed, decrypted only during execution on target node, cannot be decrypted by other nodes (including source node)

---

# MCP Tools Reference

## mgc_get

**Get node public key:**
```json
{
  "info_type": "__NODE_PUB__",
  "info_owner": "__NODE_PUB__"
}
```

**Execute sealed script:**
```json
{
  "info_type": "script",
  "info_owner": "sealed_script_identifier",
  "action": "run"
}
```

## mgc_seal

**Arguments:**
```json
{
  "info_type": "script",
  "info_owner": "original_script_identifier",
  "ext04": "target_node_public_key"
}
```

**Returns:** Sealed (encrypted) script content / key / startup command, etc.

## mgc_save

**Store original script:**
```json
{
  "info_type": "script",
  "info_owner": "script_identifier",
  "ext01": "python",
  "content": "script plaintext"
}
```

**Store sealed script:**
```json
{
  "info_type": "script",
  "info_owner": "sealed_script_identifier",
  "ext01": "python",
  "content": "sealed_encrypted_content"
}
```

---

# Troubleshooting

| Issue | Solution |
|-------|----------|
| Script fails to run | Check MGC version 1.4.6+ required |
| Credential not found | Ensure credentials stored with same info_type/info_owner on target |
| Sealing fails | Verify node_pub is valid RSA public key |
| Execution timeout | Check script dependencies are available |

---

# Links

- **Main Repository**: https://github.com/zkeviny/MGC-Blackbox
- **Issues**: https://github.com/zkeviny/MGC-Blackbox/issues
- **Contact**: mirgincipher@outlook.com
