PHPackages                             strukt/key - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. strukt/key

ActiveLibrary[Security](/categories/security)

strukt/key
==========

Cryptography

v1.1.0-alpha(1y ago)092MITPHPPHP ^8.1CI failing

Since Mar 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/struktapp/strukt-key)[ Packagist](https://packagist.org/packages/strukt/key)[ RSS](/packages/strukt-key/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

Strukt Key
==========

[](#strukt-key)

Installation
------------

[](#installation)

### Composer

[](#composer)

Create `composer.json` script with contents below then run `composer update`

```
{
    "require":{

        "strukt/key":"v1.1.0-alpha"
    },
    "minimum-stability":"dev"
}
```

Hashing
-------

[](#hashing)

### Bcrypt

[](#bcrypt)

```
$hash = bcry("p@55w0rd")->encode();
$success = bcry("p@55w0rd")->verify($hash);
```

### Sha256 (Doubled)

[](#sha256-doubled)

```
$hash = sha256dbl('p@55w0rd');
```

Public &amp; Private Keys
-------------------------

[](#public--private-keys)

Auto generate keys
------------------

[](#auto-generate-keys)

```
// $k = Strukt\Ssl\All::makeKeys();
$ks = ssl()->getKeys();
$ks->getPrivateKey()->getPem();//get Private Key
$ks->getPublicKey()->getPem();//get Public Key
$c = $ks->useCipher();
$enc = $c->encrypt("p@55w0rd");
$dec = $c->decrypt($enc);
```

### Use existing key

[](#use-existing-key)

You can generate your key via `ssh-keygen` if you wantta.

```
$file = "file:///home/churchill/.ssh/id_rsa"
// $k = Strukt\Ssl\All::keyPath($file)
$k = ssl($file);
```

### Encrypt message with Public Key

[](#encrypt-message-with-public-key)

```
$message = "Hi! My name is (what?)
My name is (who?)
My name is
Slim Shady
Hi! My name is (huh?)
My name is (what?)
My name is
Slim Shady";

$file = "file:///home/churchill/.ssh/id_rsa.pub"

// $p = new Strukt\Ssl\KeyPair();//No Private Key
// $p->setPublicKey($file);
// $p = keypair()->setPublicKey($file); //No Private Key
// $p = pubkey(local("strukt.pub")); //No Private Key
$p = pubkey($file);

// $enc = Strukt\Ssl\All::useKeys($p)->toSend($message);
$enc = ssl($p)->toSend($message);
```

### Encrypt with password

[](#encrypt-with-password)

```
// $p = new Strukt\Ssl\KeyPair($path, "p@55w0rd");
// $p->getPublicKey(); // Trigger public key extraction from private key
$p = keypair($path, "p@55w0rd");
$p->getPublicKey(); // Trigger public key extraction from private key

// $k = Strukt\Ssl\All::useKeys($p)
$k = ssl($p);
```

Certificate Signing Request (CSR)
---------------------------------

[](#certificate-signing-request-csr)

### Sign &amp; verify certificate

[](#sign--verify-certificate)

```
$kpath = "file:///home/churchill/.ssh/id_rsa"
$cpath = "file:///home/churchill/.ssh/cacert.pem"

// $oCsr = Strukt\Ssl\All::keyPath($kpath)->withCert($cpath);
$oCsr = ssl($kpath)->withCert($cpath);
$cert = $oCsr->sign();
$success = $oCsr->verify($cert);
```

Note
----

[](#note)

For local keys in your project or project root. Example:

```
├── strukt     # Private Key
└── strukt.pub # Public Key
```

You can use helper `local` to localize your path to url:

```
$k = ssl(local("strukt"));
// $p = keypair()->setPublicKey(local("strukt.pub"));
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance47

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~779 days

Total

2

Last Release

389d ago

PHP version history (2 changes)v1.0.0-alphaPHP &gt;=7.0

v1.1.0-alphaPHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f77a56030c77ce25f7fcf6db800e45bb6a31bf3c07740b43aeabcdf5e9edec2?d=identicon)[pitsolu](/maintainers/pitsolu)

---

Top Contributors

[![pitsolu](https://avatars.githubusercontent.com/u/16669704?v=4)](https://github.com/pitsolu "pitsolu (42 commits)")

---

Tags

certificate-authoritydecryptionencryptionpkiprivate-key-cryptographypublic-key-cryptographyssl

### Embed Badge

![Health badge](/badges/strukt-key/health.svg)

```
[![Health](https://phpackages.com/badges/strukt-key/health.svg)](https://phpackages.com/packages/strukt-key)
```

###  Alternatives

[leuchtfeuer/secure-downloads

"Secure Download": Apply TYPO3 access rights to ALL file assets (PDFs, TGZs or JPGs etc. - configurable) - protect them from direct access.

22234.7k1](/packages/leuchtfeuer-secure-downloads)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
