Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 733635d

Browse files
committed
Generates ASN.1 OIDs for various crypto+digest combos
1 parent eb44291 commit 733635d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

gen_algo.pl

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!perl -n
2+
#
3+
# Generates packed key data for common algorithms according to rfc7427
4+
# usage: curl https://tools.ietf.org/html/rfc7427 | perl gen_algo.pl
5+
#
6+
# -samy kamkar 06/06/2017
7+
8+
s/<.*?>//g;
9+
s/^\s*//;
10+
s/\s*$//;
11+
s/\s+/ /g;
12+
13+
if (/^A\.[0-3]\.\d+\.\S* (\S+)$/)
14+
{
15+
($name = $1) =~ s/-/_/g;
16+
print "private let SEQUENCE_OBJECT_$name:[UInt8] = [\n";
17+
$length = 0;
18+
}
19+
elsif (/^length\s*=\s*(\d+)$/i)
20+
{
21+
$length = $1;
22+
}
23+
elsif ($name && $length && /^[\da-f]{4}\s*:([\s\da-f]+)$/i)
24+
{
25+
($tmp = $1) =~ s/\s//g;
26+
print join(", ", map { "0x$_" } $tmp =~ /(..)/g) . "]\n";
27+
$name = 0;
28+
}
29+
30+
__DATA__
31+
private let SEQUENCE_OBJECT_sha256WithRSAEncryption:[UInt8] = [
32+
0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
33+
0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00]
34+

0 commit comments

Comments
 (0)