Rebase x509 onto Go 1.12

pull/99/head
JeremyRand 5 years ago
parent 9c1ba94379
commit 759c009e74
No known key found for this signature in database
GPG Key ID: B3F2D165786D6570

@ -6,12 +6,12 @@ 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
# Stdlib x509 relies on "internal" packages in Go, which aren't importable
# outside of stdlib. So we copy those packages and rename them.
OLD_INTERNAL_PATH=$(go env GOROOT)/src/internal/x/crypto/cryptobyte
NEW_INTERNAL_PATH=$(go env GOPATH)/src/github.com/namecoin/ncdns/x509/golang/x/crypto/cryptobyte
mkdir -p ${NEW_INTERNAL_PATH}/
cp -R ${OLD_INTERNAL_PATH}/* ${NEW_INTERNAL_PATH}/
OLD_PACKAGE='"internal/x/crypto/cryptobyte'
NEW_PACKAGE='"github.com/namecoin/ncdns/x509/golang/x/crypto/cryptobyte'
sed -i "s_${OLD_PACKAGE}_${NEW_PACKAGE}_g" ./*.go ${NEW_INTERNAL_PATH}/*.go

@ -6,7 +6,7 @@
// This code is modified from the stock CreateCertificate to use a
// pre-existing signature.
// Last rebased on Go 1.11
// Last rebased on Go 1.12
// Remove all content between "import" and "CreateCertificate" in original.
// Remove all content after "CreateCertificate" in original.
//go:generate bash install.sh
@ -33,6 +33,8 @@ import (
//"encoding/pem"
"errors"
//"fmt"
//"internal/x/crypto/cryptobyte"
//cryptobyte_asn1 "internal/x/crypto/cryptobyte/asn1"
//"io"
//"math/big"
//"net"
@ -41,9 +43,6 @@ import (
//"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.

Loading…
Cancel
Save