# ZATCA Certificate Storage

This directory stores your ZATCA ECDSA certificates and private keys.

## Required Files

Place the following files here:

1. **certificate.pem** - Your ECDSA certificate from ZATCA
2. **private_key.pem** - Your private key (matching the certificate)

## File Permissions

For security, set restrictive permissions:

```bash
# On Linux/Mac
chmod 600 storage/app/zatca/*.pem

# On Windows
# Right-click files → Properties → Security → Remove all users except your account
```

## Alternative Storage Locations

If you prefer to store certificates elsewhere, update your `.env` file:

```env
# Option 1: Absolute path
ZATCA_CERTIFICATE_PATH=/path/to/your/certificate.pem
ZATCA_PRIVATE_KEY_PATH=/path/to/your/private_key.pem

# Option 2: Different storage path
ZATCA_CERTIFICATE_PATH=zatca/certs/certificate.pem
ZATCA_PRIVATE_KEY_PATH=zatca/certs/private_key.pem
```

## Security Notes

⚠️ **IMPORTANT:**
- Never commit certificate files to version control
- Keep backups in a secure, encrypted location
- Rotate certificates as per ZATCA requirements
- Use different certificates for sandbox and production

## File Format

Certificates should be in PEM format:

```
-----BEGIN CERTIFICATE-----
[Base64 encoded certificate data]
-----END CERTIFICATE-----
```

Private keys should be in PEM format:

```
-----BEGIN PRIVATE KEY-----
[Base64 encoded private key data]
-----END PRIVATE KEY-----
```

Or if encrypted:

```
-----BEGIN ENCRYPTED PRIVATE KEY-----
[Base64 encoded encrypted private key data]
-----END ENCRYPTED PRIVATE KEY-----
```
