fukamachi / pem Goto Github PK
View Code? Open in Web Editor NEWPEM parser.
PEM parser.
CL-USER> (pem:read-from-file #P"~/priv4096.pem")
NIL
whenever the file contains a private key in form:
-----BEGIN PRIVATE KEY-----
MIIJQwIBADANBgk... (base64 encoded data)
-----END PRIVATE KEY-----
on (ql:quickload "pem")
got error: Package OPTIMA does not exist
.
Probably need to add (:import-from #:optima)
to pkey.lisp
Full report:
To load "pem":
Load 4 ASDF systems:
alexandria asdf cl-ppcre uiop
Install 20 Quicklisp releases:
Bike-introspect-environment Zulu-Inuoe-trivial-cltl2
cffi cl-babel-babel cl-base64 fast-io fukamachi-asn1
fukamachi-pem guicho271828-lisp-namespace
guicho271828-trivia guicho271828-type-i iterate
lmj-global-vars pcostanza-closer-mop
sharplispers-ironclad sionescu-bordeaux-threads
sionescu-static-vectors
trivial-features-trivial-features
trivial-garbage-trivial-garbage
trivial-gray-streams-trivial-gray-streams
; Fetching #<URL "http://beta.quicklisp.org/archive/cl-base64/2020-10-16/cl-base64-20201016-git.tgz">
; 10.13KB
==================================================
10,373 bytes in 0.04 seconds (276.27KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/iterate/2021-05-31/iterate-release-b0f9a9c6-git.tgz">
; 338.01KB
==================================================
346,126 bytes in 0.06 seconds (5633.56KB/sec)
; Fetching #<URL "http://dist.ultralisp.org/archive/657/Bike-introspect-environment-20220112231743.tgz">
; 9.71KB
==================================================
9,945 bytes in 0.04 seconds (264.88KB/sec)
; Fetching #<URL "http://dist.ultralisp.org/archive/154/guicho271828-type-i-20230131054045.tgz">
; 5.98KB
==================================================
6,125 bytes in 0.01 seconds (448.62KB/sec)
; Fetching #<URL "http://dist.ultralisp.org/archive/206/Zulu-Inuoe-trivial-cltl2-20211222224006.tgz">
; 6.28KB
==================================================
6,433 bytes in 0.04 seconds (171.34KB/sec)
; Fetching #<URL "http://dist.ultralisp.org/archive/952/pcostanza-closer-mop-20231110080904.tgz">
; 22.88KB
==================================================
23,431 bytes in 0.17 seconds (137.29KB/sec)
; Fetching #<URL "http://dist.ultralisp.org/archive/602/guicho271828-lisp-namespace-20220727072541.tgz">
; 9.75KB
==================================================
9,984 bytes in 0.04 seconds (265.91KB/sec)
; Fetching #<URL "http://dist.ultralisp.org/archive/215/guicho271828-trivia-20230307013854.tgz">
; 61.61KB
==================================================
63,092 bytes in 0.40 seconds (154.03KB/sec)
; Fetching #<URL "http://dist.ultralisp.org/archive/195/trivial-garbage-trivial-garbage-20231019214921.tgz">
; 10.84KB
==================================================
11,100 bytes in 0.02 seconds (541.99KB/sec)
; Fetching #<URL "http://dist.ultralisp.org/ultralisp/archive/l/lmj-global-vars-20190319075150.tgz">
; 3.41KB
==================================================
3,492 bytes in 0.04 seconds (93.01KB/sec)
; Fetching #<URL "http://dist.ultralisp.org/archive/1238/sionescu-bordeaux-threads-20230921222339.tgz">
; 57.82KB
==================================================
59,206 bytes in 0.37 seconds (156.27KB/sec)
; Fetching #<URL "http://dist.ultralisp.org/archive/655/sharplispers-ironclad-20230729201944.tgz">
; 1517.27KB
==================================================
1,553,689 bytes in 0.74 seconds (2050.37KB/sec)
; Fetching #<URL "http://dist.ultralisp.org/archive/194/trivial-gray-streams-trivial-gray-streams-20230630171731.tgz">
; 8.03KB
==================================================
8,224 bytes in 0.01 seconds (1204.63KB/sec)
; Fetching #<URL "http://dist.ultralisp.org/archive/197/trivial-features-trivial-features-20230614074348.tgz">
; 11.16KB
==================================================
11,431 bytes in 0.04 seconds (304.45KB/sec)
; Fetching #<URL "http://dist.ultralisp.org/archive/1237/cl-babel-babel-20230131043757.tgz">
; 270.76KB
==================================================
277,262 bytes in 0.71 seconds (383.16KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/cffi/2023-10-21/cffi-20231021-git.tgz">
; 257.22KB
==================================================
263,396 bytes in 0.04 seconds (7015.29KB/sec)
; Fetching #<URL "http://dist.ultralisp.org/archive/268/sionescu-static-vectors-20220619120309.tgz">
; 6.89KB
==================================================
7,054 bytes in 0.01 seconds (688.87KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/fast-io/2022-11-06/fast-io-20221106-git.tgz">
; 9.45KB
==================================================
9,680 bytes in 0.04 seconds (257.81KB/sec)
; Fetching #<URL "http://dist.ultralisp.org/archive/1412/fukamachi-asn1-20220329013610.tgz">
; 5.59KB
==================================================
5,724 bytes in 0.01 seconds (558.98KB/sec)
; Fetching #<URL "http://dist.ultralisp.org/ultralisp/archive/f/fukamachi-pem-20200406050549.tgz">
; 1.65KB
==================================================
1,685 bytes in 0.04 seconds (44.88KB/sec)
; Loading "pem"
..................................................
[package pem/parser]..............................
[package asn1/decode].............................
[package impl-specific-gray]......................
[package trivial-gray-streams]....................
[package babel-encodings].........................
[package babel]...................................
..................................................
[package cffi-sys]................................
[package cffi-features]...........................
[package cffi]....................................
..................................................
[package static-vectors]..........................
[package fast-io].................................
[package global-vars].............................
[package trivial-garbage].........................
[package bordeaux-threads]........................
[package bordeaux-threads-2]......................
[package ironclad]................................
[package ironclad-vm].............................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
[package asn1/encode].............................
[package trivia.level0]...........................
[package trivia.level1]...........................
[package trivia.fail].............................
[package trivia.skip].............................
[package trivia.next].............................
[package trivia.level1.impl]......................
[package lisp-namespace]..........................
[package closer-mop]..............................
[package closer-common-lisp]......................
[package closer-common-lisp-user].................
[package trivial-cltl2]...........................
[package trivia.level2]...........................
[package trivia.level2.impl]......................
..................................................
[package introspect-environment]..................
[package type-i]..................................
[package iterate].................................
[package trivia.balland2006]......................
[package asn1/format/public-key]..................
[package asn1/format/rsa].........................
[package cl-base64]...............................
[package pem/pkey]
;
; caught ERROR:
; READ error during COMPILE-FILE:
;
; Package OPTIMA does not exist.
;
; Line: 17, Column: 17, File-Position: 476
;
; Stream: #<SB-INT:FORM-TRACKING-STREAM for "file /home/junker/.quicklisp/dists/ultralisp/software/fukamachi-pem-2```
if i run openssl genrsa -out private.pem 2048
to make a RSA key saved to private.pem
, i'm unable to read it with pem:read-from-file
.
firstly, the file's header is "BEGIN PRIVATE KEY", not "BEGIN RSA PRIVATE KEY", so the assoc
call fails.
but even if i add RSA to the pem file, or remove the RSA from the assoc string that does the check, read-private-key
still fails and i get the Unexpected format
error.
do you have any ideas about how to get this working? or how to create a private key pem file in a way that this library will happily read it?
(apologies if this is glaringly obvious, i'm no crypto expert.)
I would like to use e.g. ES256
in some applications. See fukamachi/jose#3. For Jose to support this we have to update pem
first. Before sending a PR i wanted to ask how the implementation should be structured:
read-from-file
? This works simple with private key files but a bit more tricky with public key files.read-ec-from-file
?is there a way pem and/or ironclad can write rsa-public/private-key objects back to pem format?
i'm trying to work out http signatures in CL.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.