[FIX] delete license code

This commit is contained in:
goodrain 2017-11-15 10:47:19 +08:00
commit 5e3bd42768
3 changed files with 15 additions and 34 deletions

View File

@ -1,27 +1,24 @@
// RAINBOND, Application Management Platform
// Copyright (C) 2014-2017 Goodrain Co., Ltd.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. For any non-GPL usage of Rainbond,
// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd.
// must be obtained first.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package handler
import (
"crypto/aes"
"crypto/cipher"
"encoding/base64"
"encoding/json"
"errors"
@ -53,22 +50,7 @@ var key = []byte("qa123zxswe3532crfvtg123bnhymjuki")
//decrypt 解密算法
func decrypt(key []byte, encrypted string) ([]byte, error) {
ciphertext, err := base64.RawURLEncoding.DecodeString(encrypted)
if err != nil {
return nil, err
}
block, err := aes.NewCipher(key)
if err != nil {
return nil, err
}
if len(ciphertext) < aes.BlockSize {
return nil, errors.New("ciphertext too short")
}
iv := ciphertext[:aes.BlockSize]
ciphertext = ciphertext[aes.BlockSize:]
cfb := cipher.NewCFBDecrypter(block, iv)
cfb.XORKeyStream(ciphertext, ciphertext)
return ciphertext, nil
return []byte{}, nil
}
//ReadLicenseFromFile 从文件获取license

View File

@ -1,19 +1,18 @@
// RAINBOND, Application Management Platform
// Copyright (C) 2014-2017 Goodrain Co., Ltd.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. For any non-GPL usage of Rainbond,
// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd.
// must be obtained first.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
@ -25,7 +24,7 @@ import (
)
func TestLicense(t *testing.T) {
licenseStr := "0QFGbwit-t5nOn9Eq1NssMSAkiL99iHYbYCOAHFHDEm5u0BB4PUxm3WfwxMEPYPg6hbEiaR803ponhc3cLnxIPNiUU72-RtNdCKy-gssxLF03f8L6UVraaUvasVOz3vjtdbT8u7Cq99whd6C_wk7D-Wh-VjQhkeprPbaJtiUiy8_P48sWVBEET0l3_NwbOvYRmFS6zFeJ5JxC0DLNb0ajkCyIK9RWsZLVlSi2Qp4SCCG4CDf3oUTwxd63njjrPhuqZEaRFEyKzmZXDuxCYVDidCFWMhMKXGP"
licenseStr := "0QFGbwit-"
text, err := decrypt(key, licenseStr)
if err != nil {
fmt.Println("decrypt err")
@ -34,7 +33,7 @@ func TestLicense(t *testing.T) {
}
func TestToken(t *testing.T) {
licenseStr := "0QFGbwit-t5nOn9Eq1NssMSAkiL99iHYbYCOAHFHDEm5u0BB4PUxm3WfwxMEPYPg6hbEiaR803ponhc3cLnxIPNiUU72-RtNdCKy-gssxLF03f8L6UVraaUvasVOz3vjtdbT8u7Cq99whd6C_wk7D-Wh-VjQhkeprPbaJtiUiy8_P48sWVBEET0l3_NwbOvYRmFS6zFeJ5JxC0DLNb0ajkCyIK9RWsZLVlSi2Qp4SCCG4CDf3oUTwxd63njjrPhuqZEaRFEyKzmZXDuxCYVDidCFWMhMKXGP"
licenseStr := "0QFGbwit-"
token, err := BasePack([]byte(licenseStr))
if err != nil {
fmt.Printf("error")

View File

@ -1,36 +1,36 @@
// RAINBOND, Application Management Platform
// Copyright (C) 2014-2017 Goodrain Co., Ltd.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. For any non-GPL usage of Rainbond,
// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd.
// must be obtained first.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package handler
import (
api_model "github.com/goodrain/rainbond/pkg/api/model"
"fmt"
"strings"
"testing"
api_model "github.com/goodrain/rainbond/pkg/api/model"
"github.com/Sirupsen/logrus"
"github.com/pquerna/ffjson/ffjson"
uuid "github.com/satori/go.uuid"
)
func TestService(t *testing.T) {
func TestABCService(t *testing.T) {
mm := `{
"comment":"",
"container_env":"",