Files
web-giao-ban-go/license/license_test.go
T

33 lines
1.0 KiB
Go

package license
import (
"testing"
)
func TestOpenSSLDecryptUserKey(t *testing.T) {
cipherText := "U2FsdGVkX18Zsq52FPbB7FS1QM7CwWh+t1Esi96gUMFILJD0vZXM69uQBC4sP7TjLVOiJPZt0KIq17iql+hXehLCVSbCEhwKKm+zNab+u2Swah63A52hz0KMJXddLRZ6vanmP2goLTzY7749HsFVRDq+3bdbi8fdUZCpAsSTEiqC2cRTpF5WVh0SHt1wX/i42YSQgOYPeXQtg+lRx/URk4p7lYSVQOYWXglp99kO+Va1ADoNcTgrfz3aaAxAkj0S"
passphrase := "BAD5A05F330D5B8CDDFCA9E7ECDC840B"
info, err := ValidateAndParseLicense(cipherText, passphrase)
if err != nil {
t.Fatalf("Validation failed: %v", err)
}
if info.Mabvbh != "84006" {
t.Errorf("Expected Mabvbh 84006, got %s", info.Mabvbh)
}
if info.Key != "web_giao_ban" {
t.Errorf("Expected Key web_giao_ban, got %s", info.Key)
}
if info.TenBV != "Trà Cú" {
t.Errorf("Expected TenBV Trà Cú, got %s", info.TenBV)
}
if info.DateExpires != "2027-01-30" {
t.Errorf("Expected DateExpires 2027-01-30, got %s", info.DateExpires)
}
if !info.IsValid {
t.Errorf("Expected IsValid true, got false (%s)", info.StatusMessage)
}
t.Logf("Decrypted successfully: %+v", info)
}