-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sign() builtin for emitting digital signatures
- Loading branch information
Showing
4 changed files
with
276 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
# This is the same certificate as cert.txt, but with the signature generated | ||
# using sign(). | ||
# | ||
# ascii2der will assemble both files to equal byte strings, because RSA-SSA | ||
# happens to be deterministic. | ||
|
||
# Our private key, in PKCS #8 form. | ||
define("my_key", SEQUENCE { | ||
INTEGER { 0 } | ||
SEQUENCE { | ||
# rsaEncryption | ||
OBJECT_IDENTIFIER { 1.2.840.113549.1.1.1 } | ||
NULL {} | ||
} | ||
OCTET_STRING { | ||
SEQUENCE { | ||
INTEGER { 0 } | ||
INTEGER { `00d82bc8a632e462ff4df3d0ad598b45a7bdf147bf09587b22bd35ae97258694a080c0b41f7691674631d01084b7221e70239172c8e96d793a8577800fc4951675c54a714cc8633fa3f2639c2a4f9afacbc1716e288528a0271e651cae07d55b6f2d43ed2b90b18caf246daee9173a05c1bfb81cae653b1b58c2d9aed6aa6788f1` } | ||
INTEGER { 65537 } | ||
INTEGER { `008072d3d15de033aafc88e9f0778ab8230a4c7a935b5c461ec84b43a8f0555daf599227f5a220983b2f92309e8bab2c66f9db8d5730cd2a01ca18cdf1909ffe2d791c40960c5161ea0b743f9cf43270a1c33666bdab55fc55c24f48fe5a618d07f8247a12a31972cb7234dbe9d45854948266156e38b2dc6d6215d74820809401` } | ||
INTEGER { `00f12f2c19ee1ecf2c999b87bdafde60eace3790faad8f9adec13b14c6dfb69f8795a1d0fe65494250b59534014b918453042012952ae6f5786342999600725491` } | ||
INTEGER { `00e57341d15469ec0bb5d389a0f0ada58a18d73776d9e69ef134049a918e475d4bea46f12d0b2468c972fc33a739a6bcdada8019376a0c466048d98278a2a49e61` } | ||
INTEGER { `0be99d8f0650e540b9b191e9cf96f74881b902e32ed169ffd8a1776c3f3e80f0ac765aa14615713e1549f250a20fe4ee48c4e0c6176162fc7842a0dd64d640d1` } | ||
INTEGER { `00e4d74e168bdd5499dd4fcc5d228ddda35ce111254d7010a7ba5cb91860d1d64007b99782783168fd39dc455c0c48bae47fb5f0f06ea92d6b8c5cbb1ebbfff921` } | ||
INTEGER { `00bef4572c74da6ba545cd36a288ef12685b07577950c973ad32b0690798dd9a86568231ef0765bd0a49fbb03aac3c1f94dadc97d23a03750132ba230408363ca1` } | ||
} | ||
} | ||
}) | ||
|
||
# The "to be signed" portion of our cert. | ||
define("tbs_cert", SEQUENCE { | ||
[0] { | ||
INTEGER { 2 } | ||
} | ||
INTEGER { `00fbb04c2eab109b0c` } | ||
SEQUENCE { | ||
# sha1WithRSAEncryption | ||
OBJECT_IDENTIFIER { 1.2.840.113549.1.1.5 } | ||
NULL {} | ||
} | ||
SEQUENCE { | ||
SET { | ||
SEQUENCE { | ||
# countryName | ||
OBJECT_IDENTIFIER { 2.5.4.6 } | ||
PrintableString { "AU" } | ||
} | ||
} | ||
SET { | ||
SEQUENCE { | ||
# stateOrProvinceName | ||
OBJECT_IDENTIFIER { 2.5.4.8 } | ||
UTF8String { "Some-State" } | ||
} | ||
} | ||
SET { | ||
SEQUENCE { | ||
# organizationName | ||
OBJECT_IDENTIFIER { 2.5.4.10 } | ||
UTF8String { "Internet Widgits Pty Ltd" } | ||
} | ||
} | ||
} | ||
SEQUENCE { | ||
UTCTime { "140423205040Z" } | ||
UTCTime { "170422205040Z" } | ||
} | ||
SEQUENCE { | ||
SET { | ||
SEQUENCE { | ||
# countryName | ||
OBJECT_IDENTIFIER { 2.5.4.6 } | ||
PrintableString { "AU" } | ||
} | ||
} | ||
SET { | ||
SEQUENCE { | ||
# stateOrProvinceName | ||
OBJECT_IDENTIFIER { 2.5.4.8 } | ||
UTF8String { "Some-State" } | ||
} | ||
} | ||
SET { | ||
SEQUENCE { | ||
# organizationName | ||
OBJECT_IDENTIFIER { 2.5.4.10 } | ||
UTF8String { "Internet Widgits Pty Ltd" } | ||
} | ||
} | ||
} | ||
SEQUENCE { | ||
SEQUENCE { | ||
# rsaEncryption | ||
OBJECT_IDENTIFIER { 1.2.840.113549.1.1.1 } | ||
NULL {} | ||
} | ||
BIT_STRING { | ||
`00` | ||
SEQUENCE { | ||
INTEGER { `00d82bc8a632e462ff4df3d0ad598b45a7bdf147bf09587b22bd35ae97258694a080c0b41f7691674631d01084b7221e70239172c8e96d793a8577800fc4951675c54a714cc8633fa3f2639c2a4f9afacbc1716e288528a0271e651cae07d55b6f2d43ed2b90b18caf246daee9173a05c1bfb81cae653b1b58c2d9aed6aa6788f1` } | ||
INTEGER { 65537 } | ||
} | ||
} | ||
} | ||
[3] { | ||
SEQUENCE { | ||
SEQUENCE { | ||
# subjectKeyIdentifier | ||
OBJECT_IDENTIFIER { 2.5.29.14 } | ||
OCTET_STRING { | ||
OCTET_STRING { `8b75d5accb08be0e1f65b7fa56be6ca775da85af` } | ||
} | ||
} | ||
SEQUENCE { | ||
# authorityKeyIdentifier | ||
OBJECT_IDENTIFIER { 2.5.29.35 } | ||
OCTET_STRING { | ||
SEQUENCE { | ||
[0 PRIMITIVE] { `8b75d5accb08be0e1f65b7fa56be6ca775da85af` } | ||
} | ||
} | ||
} | ||
SEQUENCE { | ||
# basicConstraints | ||
OBJECT_IDENTIFIER { 2.5.29.19 } | ||
OCTET_STRING { | ||
SEQUENCE { | ||
BOOLEAN { TRUE } | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}) | ||
|
||
SEQUENCE { | ||
var("tbs_cert") | ||
SEQUENCE { | ||
# sha1WithRSAEncryption | ||
OBJECT_IDENTIFIER { 1.2.840.113549.1.1.5 } | ||
NULL {} | ||
} | ||
BIT_STRING { | ||
`00` | ||
sign("RSA_PKCS1_SHA1", var("my_key"), var("tbs_cert")) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters