Skip to content

Commit

Permalink
x509: update generator
Browse files Browse the repository at this point in the history
  • Loading branch information
aerth committed Oct 8, 2018
1 parent 5235417 commit 5050845
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 37 deletions.
27 changes: 10 additions & 17 deletions x509/install.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
#!/bin/bash

set -eu -o pipefail
shopt -s failglob

cp -a $(go env GOROOT)/src/crypto/x509/* ./
rm ./x509_test.go

# The following code is utterly horrifying. I can't find a better way to do it. :(
mkdir -p ${GOPATH}/src/vendor/golang.org/
cp -R $(go env GOROOT)/src/vendor/golang_org/* ${GOPATH}/src/vendor/golang.org/
# h/t to https://www.cyberciti.biz/faq/unix-linux-replace-string-words-in-many-files/
OLD_PACKAGE='"golang_org/x/crypto/cryptobyte'
OLD_PACKAGE="${OLD_PACKAGE//\//\\/}"
NEW_PACKAGE='"golang.org/x/crypto/cryptobyte'
NEW_PACKAGE="${NEW_PACKAGE//\//\\/}"
sed -i "s/${OLD_PACKAGE}/${NEW_PACKAGE}/g" ./*.go ${GOPATH}/src/vendor/golang.org/x/crypto/cryptobyte/*.go
#!/bin/sh
set -e
gopath="$(go env GOROOT)"
x509path=$gopath/src/crypto/x509
test -d $gopath
test -d $x509path
cp -av $x509path/testdata .
cp -v $x509path/*.* .
rm x509_test.go
sed -i.bak 's/golang_org/golang.org/g' x509.go
21 changes: 1 addition & 20 deletions x509/x509_splice.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Last rebased on Go 1.10
// Remove all content between "import" and "CreateCertificate" in original.
// Remove all content after "CreateCertificate" in original.
//go:generate bash install.sh
//go:generate sh install.sh

// Package x509 parses X.509-encoded keys and certificates.
//
Expand All @@ -20,30 +20,11 @@ package x509

import (
"bytes"
//"crypto"
//"crypto/dsa"
//"crypto/ecdsa"
//"crypto/elliptic"
//"crypto/rsa"
_ "crypto/sha1"
_ "crypto/sha256"
_ "crypto/sha512"
//"crypto/x509/pkix"
"encoding/asn1"
//"encoding/pem"
"errors"
//"fmt"
//"io"
//"math/big"
//"net"
//"net/url"
//"strconv"
//"strings"
//"time"
//"unicode/utf8"
//
//"golang_org/x/crypto/cryptobyte"
//cryptobyte_asn1 "golang_org/x/crypto/cryptobyte/asn1"
)

// CreateCertificate creates a new X.509v3 certificate based on a template.
Expand Down

0 comments on commit 5050845

Please sign in to comment.