An open API service indexing awesome lists of open source software.

https://github.com/saidone75/clj-ssh-keygen

Generate RSA PKCS #1 key-pairs from scratch (without 3rd party libs) in Clojure
https://github.com/saidone75/clj-ssh-keygen

authentication cryptography keygen keypair ssh ssh-key

Last synced: 3 months ago
JSON representation

Generate RSA PKCS #1 key-pairs from scratch (without 3rd party libs) in Clojure

Awesome Lists containing this project

README

          

# clj-ssh-keygen

[![Clojars Project](https://img.shields.io/clojars/v/clj-ssh-keygen.svg)](https://clojars.org/clj-ssh-keygen)
[![cljdoc badge](https://cljdoc.org/badge/clj-ssh-keygen/clj-ssh-keygen)](https://cljdoc.org/d/clj-ssh-keygen/clj-ssh-keygen)

Generate RSA PKCS #1 keys **from scratch** and **without 3rd party libs** in Clojure, export **PEM** and **OpenSSH** formats

*☛ intended for hacking and educational purposes only!*

![public key](https://i.postimg.cc/HLhvSkpk/pubkey.png)

## Usage
```clojure
(let [key (generate-key)]
(write-private-key! key "pvt.pem")
(write-public-key! key "pub.pem")
(write-openssh-public-key! key "id_rsa.pub")))
```
for generating a default (2048 bit) length key, while:
```clojure
(write-private-key! (generate-key 2345) "pvt.pem")
```
will issue a custom length key:
```console
$ openssl rsa -noout -text -in pvt.pem|head -n 1
RSA Private-Key: (2345 bit, 2 primes)
```

## License
Copyright (c) 2020-2024 Saidone

Distributed under the MIT License