Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Commit

Permalink
version 3
Browse files Browse the repository at this point in the history
  • Loading branch information
btoews committed Jul 26, 2017
1 parent cc2385f commit c540240
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 33 deletions.
67 changes: 34 additions & 33 deletions SelfSignedCertificate/SelfSignedCertificate.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@
/*
Certificate:
Data:
Version: 1 (0x0)
Version: 3 (0x2)
Serial Number: 1 (0x1)
Signature Algorithm: ecdsa-with-SHA256
Issuer: CN=Soft U2F, O=GitHub Inc., OU=Security
Validity
Not Before: Jul 24 23:38:27 2017 GMT
Not After : Jul 22 23:38:27 2027 GMT
Not Before: Jul 26 20:09:08 2017 GMT
Not After : Jul 24 20:09:08 2027 GMT
Subject: CN=Soft U2F, O=GitHub Inc., OU=Security
Subject Public Key Info:
Public Key Algorithm: id-ecPublicKey
EC Public Key:
Public-Key: (256 bit)
pub:
04:f6:9c:ab:24:14:4b:b4:ef:87:f7:0f:23:1c:5c:
d4:f5:78:04:ac:f8:e0:c6:b2:b3:e3:52:18:3d:80:
Expand All @@ -47,39 +47,40 @@
1.3.6.1.4.1.45724.2.1.1:
....
Signature Algorithm: ecdsa-with-SHA256
30:45:02:21:00:f6:c8:fd:40:c2:32:b4:d2:a6:15:24:10:44:
5f:b0:78:6c:63:69:74:d4:fd:f0:53:c5:46:be:c9:9a:c7:02:
67:02:20:40:b5:f1:a4:5f:c7:fc:06:d4:88:9d:de:fb:8c:dc:
23:ba:b0:42:d9:f0:83:3d:fd:06:29:7f:07:9d:81:f1:8a
30:45:02:21:00:fe:22:1d:97:b8:ea:ea:12:bb:9f:42:14:85:
0f:48:17:65:b5:e0:95:93:5e:a1:a3:d6:6d:0f:b1:6f:39:f7:
22:02:20:64:d7:dc:2f:5c:6c:38:2a:f7:65:f5:78:6a:39:b0:
b1:4a:97:45:28:ef:7d:df:21:02:15:1b:88:4a:d4:41:7a
*/
const unsigned char *cert = (unsigned char*)
"\x30\x82\x01\x79\x30\x82\x01\x1f\x02\x01\x01\x30\x0a\x06\x08\x2a"
"\x86\x48\xce\x3d\x04\x03\x02\x30\x3c\x31\x11\x30\x0f\x06\x03\x55"
"\x04\x03\x0c\x08\x53\x6f\x66\x74\x20\x55\x32\x46\x31\x14\x30\x12"
"\x06\x03\x55\x04\x0a\x0c\x0b\x47\x69\x74\x48\x75\x62\x20\x49\x6e"
"\x63\x2e\x31\x11\x30\x0f\x06\x03\x55\x04\x0b\x0c\x08\x53\x65\x63"
"\x75\x72\x69\x74\x79\x30\x1e\x17\x0d\x31\x37\x30\x37\x32\x34\x32"
"\x33\x33\x38\x32\x37\x5a\x17\x0d\x32\x37\x30\x37\x32\x32\x32\x33"
"\x33\x38\x32\x37\x5a\x30\x3c\x31\x11\x30\x0f\x06\x03\x55\x04\x03"
"\x0c\x08\x53\x6f\x66\x74\x20\x55\x32\x46\x31\x14\x30\x12\x06\x03"
"\x55\x04\x0a\x0c\x0b\x47\x69\x74\x48\x75\x62\x20\x49\x6e\x63\x2e"
"\x31\x11\x30\x0f\x06\x03\x55\x04\x0b\x0c\x08\x53\x65\x63\x75\x72"
"\x69\x74\x79\x30\x59\x30\x13\x06\x07\x2a\x86\x48\xce\x3d\x02\x01"
"\x06\x08\x2a\x86\x48\xce\x3d\x03\x01\x07\x03\x42\x00\x04\xf6\x9c"
"\xab\x24\x14\x4b\xb4\xef\x87\xf7\x0f\x23\x1c\x5c\xd4\xf5\x78\x04"
"\xac\xf8\xe0\xc6\xb2\xb3\xe3\x52\x18\x3d\x80\x39\x1f\x6b\xd2\x79"
"\xd2\x6a\x4c\x83\x64\x74\xe6\xc2\xda\x23\x93\xff\xac\x1d\x50\x34"
"\x6c\x5c\x23\x90\x65\x57\x93\x3e\xcb\x93\xff\x6e\xde\xd1\xa3\x17"
"\x30\x15\x30\x13\x06\x0b\x2b\x06\x01\x04\x01\x82\xe5\x1c\x02\x01"
"\x01\x04\x04\x03\x02\x03\x08\x30\x0a\x06\x08\x2a\x86\x48\xce\x3d"
"\x04\x03\x02\x03\x48\x00\x30\x45\x02\x21\x00\xf6\xc8\xfd\x40\xc2"
"\x32\xb4\xd2\xa6\x15\x24\x10\x44\x5f\xb0\x78\x6c\x63\x69\x74\xd4"
"\xfd\xf0\x53\xc5\x46\xbe\xc9\x9a\xc7\x02\x67\x02\x20\x40\xb5\xf1"
"\xa4\x5f\xc7\xfc\x06\xd4\x88\x9d\xde\xfb\x8c\xdc\x23\xba\xb0\x42"
"\xd9\xf0\x83\x3d\xfd\x06\x29\x7f\x07\x9d\x81\xf1\x8a";
"\x30\x82\x01\x7e\x30\x82\x01\x24\xa0\x03\x02\x01\x02\x02\x01\x01"
"\x30\x0a\x06\x08\x2a\x86\x48\xce\x3d\x04\x03\x02\x30\x3c\x31\x11"
"\x30\x0f\x06\x03\x55\x04\x03\x0c\x08\x53\x6f\x66\x74\x20\x55\x32"
"\x46\x31\x14\x30\x12\x06\x03\x55\x04\x0a\x0c\x0b\x47\x69\x74\x48"
"\x75\x62\x20\x49\x6e\x63\x2e\x31\x11\x30\x0f\x06\x03\x55\x04\x0b"
"\x0c\x08\x53\x65\x63\x75\x72\x69\x74\x79\x30\x1e\x17\x0d\x31\x37"
"\x30\x37\x32\x36\x32\x30\x30\x39\x30\x38\x5a\x17\x0d\x32\x37\x30"
"\x37\x32\x34\x32\x30\x30\x39\x30\x38\x5a\x30\x3c\x31\x11\x30\x0f"
"\x06\x03\x55\x04\x03\x0c\x08\x53\x6f\x66\x74\x20\x55\x32\x46\x31"
"\x14\x30\x12\x06\x03\x55\x04\x0a\x0c\x0b\x47\x69\x74\x48\x75\x62"
"\x20\x49\x6e\x63\x2e\x31\x11\x30\x0f\x06\x03\x55\x04\x0b\x0c\x08"
"\x53\x65\x63\x75\x72\x69\x74\x79\x30\x59\x30\x13\x06\x07\x2a\x86"
"\x48\xce\x3d\x02\x01\x06\x08\x2a\x86\x48\xce\x3d\x03\x01\x07\x03"
"\x42\x00\x04\xf6\x9c\xab\x24\x14\x4b\xb4\xef\x87\xf7\x0f\x23\x1c"
"\x5c\xd4\xf5\x78\x04\xac\xf8\xe0\xc6\xb2\xb3\xe3\x52\x18\x3d\x80"
"\x39\x1f\x6b\xd2\x79\xd2\x6a\x4c\x83\x64\x74\xe6\xc2\xda\x23\x93"
"\xff\xac\x1d\x50\x34\x6c\x5c\x23\x90\x65\x57\x93\x3e\xcb\x93\xff"
"\x6e\xde\xd1\xa3\x17\x30\x15\x30\x13\x06\x0b\x2b\x06\x01\x04\x01"
"\x82\xe5\x1c\x02\x01\x01\x04\x04\x03\x02\x03\x08\x30\x0a\x06\x08"
"\x2a\x86\x48\xce\x3d\x04\x03\x02\x03\x48\x00\x30\x45\x02\x21\x00"
"\xfe\x22\x1d\x97\xb8\xea\xea\x12\xbb\x9f\x42\x14\x85\x0f\x48\x17"
"\x65\xb5\xe0\x95\x93\x5e\xa1\xa3\xd6\x6d\x0f\xb1\x6f\x39\xf7\x22"
"\x02\x20\x64\xd7\xdc\x2f\x5c\x6c\x38\x2a\xf7\x65\xf5\x78\x6a\x39"
"\xb0\xb1\x4a\x97\x45\x28\xef\x7d\xdf\x21\x02\x15\x1b\x88\x4a\xd4"
"\x41\x7a";

const int priv_len = 121;
const int cert_len = 381;
const int cert_len = 386;

@implementation SelfSignedCertificate {}

Expand Down
1 change: 1 addition & 0 deletions script/generate_certificate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def generate_cert(private_key:, subject:, transports:)
private_key.define_singleton_method(:public?) { public_key? }

OpenSSL::X509::Certificate.new().tap do |cert|
cert.version = 2
cert.serial = 1
cert.subject = cert.issuer = OpenSSL::X509::Name.parse(subject)
cert.not_before = Time.now
Expand Down

0 comments on commit c540240

Please sign in to comment.