Skip to content

Commit

Permalink
add base64 for public key (labring#3470)
Browse files Browse the repository at this point in the history
  • Loading branch information
yxxchange committed Jul 6, 2023
1 parent 22b0d6c commit 9e83f02
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
13 changes: 12 additions & 1 deletion controllers/cloud/deploy/manifests/configmaps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,15 @@ data: null
kind: ConfigMap
metadata:
name: cloud-license-history
namespace: cloud-system
namespace: cloud-system
---
apiVersion: v1
kind: Secret
metadata:
name: cloud-secret
namespace: cloud-system
labels:
registered: "false"
data:
"uid": "e30="
"key": "e30="
6 changes: 5 additions & 1 deletion controllers/pkg/crypto/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ func Decrypt(ciphertextBase64 string) ([]byte, error) {
}

func IsLicenseValid(license v1.License) (map[string]interface{}, bool) {
publicKey, err := parseRSAPublicKeyFromPEM(license.Spec.Key)
decodeKey, err := base64.StdEncoding.DecodeString(license.Spec.Key)
if err != nil {
return nil, false
}
publicKey, err := parseRSAPublicKeyFromPEM(string(decodeKey))
if err != nil {
return nil, false
}
Expand Down

0 comments on commit 9e83f02

Please sign in to comment.