update JetBrains License Server Makefile

This commit is contained in:
ehlxr 2018-01-22 18:48:38 +08:00
parent 92a372dcef
commit c3fa7856e8
2 changed files with 17 additions and 19 deletions

View File

@ -3,9 +3,7 @@ GOARCH := $(shell go env | awk -F= '$$1=="GOARCH" {print $$2}' | awk -F '"' '{pr
.PHONY: build .PHONY: build
build: build:
echo $(strip $(GOOS))-2 @go build -ldflags "-s -w" -o JetBrainsLicenseServer_$(strip $(GOOS))_$(strip $(GOARCH))
go build -ldflags "-s -w" -o JetBrainsLicenseServer_$(strip $(GOOS))_$(strip $(GOARCH))
@upx JetBrainsLicenseServer_$(strip $(GOOS))_$(strip $(GOARCH))
.PHONY: amd64 .PHONY: amd64
amd64: amd64:

View File

@ -10,7 +10,6 @@ import (
"encoding/pem" "encoding/pem"
"flag" "flag"
"fmt" "fmt"
"io/ioutil"
"log" "log"
"net/http" "net/http"
"os" "os"
@ -96,24 +95,25 @@ func obtainTicket(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("<!-- " + xmlSignature + " -->\n" + xmlResponse)) w.Write([]byte("<!-- " + xmlSignature + " -->\n" + xmlResponse))
} }
// var privateKey = []byte(` var privateKey = []byte(`
// -----BEGIN RSA PRIVATE KEY----- -----BEGIN RSA PRIVATE KEY-----
// MIIBOgIBAAJBALecq3BwAI4YJZwhJ+snnDFj3lF3DMqNPorV6y5ZKXCiCMqj8OeOmxk4YZW9aaV9 MIIBOgIBAAJBALecq3BwAI4YJZwhJ+snnDFj3lF3DMqNPorV6y5ZKXCiCMqj8OeOmxk4YZW9aaV9
// ckl/zlAOI0mpB3pDT+Xlj2sCAwEAAQJAW6/aVD05qbsZHMvZuS2Aa5FpNNj0BDlf38hOtkhDzz/h ckl/zlAOI0mpB3pDT+Xlj2sCAwEAAQJAW6/aVD05qbsZHMvZuS2Aa5FpNNj0BDlf38hOtkhDzz/h
// kYb+EBYLLvldhgsD0OvRNy8yhz7EjaUqLCB0juIN4QIhAOeCQp+NXxfBmfdG/S+XbRUAdv8iHBl+ kYb+EBYLLvldhgsD0OvRNy8yhz7EjaUqLCB0juIN4QIhAOeCQp+NXxfBmfdG/S+XbRUAdv8iHBl+
// F6O2wr5fA2jzAiEAywlDfGIl6acnakPrmJE0IL8qvuO3FtsHBrpkUuOnXakCIQCqdr+XvADI/UTh F6O2wr5fA2jzAiEAywlDfGIl6acnakPrmJE0IL8qvuO3FtsHBrpkUuOnXakCIQCqdr+XvADI/UTh
// TuQepuErFayJMBSAsNe3NFsw0cUxAQIgGA5n7ZPfdBi3BdM4VeJWb87WrLlkVxPqeDSbcGrCyMkC TuQepuErFayJMBSAsNe3NFsw0cUxAQIgGA5n7ZPfdBi3BdM4VeJWb87WrLlkVxPqeDSbcGrCyMkC
// IFSs5JyXvFTreWt7IQjDssrKDRIPmALdNjvfETwlNJyY IFSs5JyXvFTreWt7IQjDssrKDRIPmALdNjvfETwlNJyY
// -----END RSA PRIVATE KEY----- -----END RSA PRIVATE KEY-----
// `) `)
func signature(message string) (string, error) { func signature(message string) (string, error) {
key, err := ioutil.ReadFile("rsa.key") // key, err := ioutil.ReadFile("rsa.key")
if err != nil { // if err != nil {
return "", err // return "", err
} // }
// pem, _ := pem.Decode(key)
pem, _ := pem.Decode(key) pem, _ := pem.Decode([]byte(privateKey))
rsaPrivateKey, err := x509.ParsePKCS1PrivateKey(pem.Bytes) rsaPrivateKey, err := x509.ParsePKCS1PrivateKey(pem.Bytes)
hashedMessage := md5.Sum([]byte(message)) hashedMessage := md5.Sum([]byte(message))