Documentation
¶
Index ¶
- func GenerateRequestFileType1(reqFileName string) error
- func GetMachineFingerprintType1() (string, error)
- func GetMachineFingerprintType2() (string, error)
- func GetMachineFingerprintType3() (*machinecode.MachineCode, error)
- func LoadPrivateKeyFromBytes(content []byte) (ed25519.PrivateKey, error)
- func LoadPrivateKeyFromFile(filePath string) (ed25519.PrivateKey, error)
- func LoadPublicKeyFromBytes(content []byte) (ed25519.PublicKey, error)
- func LoadPublicKeyFromFile(filePath string) (ed25519.PublicKey, error)
- func LoadRequestFromFile(filename string) (string, error)
- func SaveLicenseToFile(license *License, filename string) error
- func SaveOffAuthToFile(offAuth *OffAuth, filename string) error
- func SavePrivateKeyToFile(privateKey ed25519.PrivateKey, filePath string) error
- func SavePublicKeyToFile(publicKey ed25519.PublicKey, filePath string) error
- func VerifyLicense(license *License, publicKey ed25519.PublicKey) (bool, error)
- func VerifyLicenseType1(license *License, publicKey ed25519.PublicKey) (bool, error)
- func VerifyOffAuth(offAuth *OffAuth, publicKey ed25519.PublicKey) (bool, error)
- type License
- type OffAuth
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateRequestFileType1 ¶
GenerateRequestFileType1 生成请求文件类型1,将machinecode.MachineCode转为字符串然后做base64编码
func GetMachineFingerprintType1 ¶
将machinecode.MachineCode转为字符串然后做base64编码
func GetMachineFingerprintType3 ¶
func GetMachineFingerprintType3() (*machinecode.MachineCode, error)
func LoadPrivateKeyFromBytes ¶
func LoadPrivateKeyFromBytes(content []byte) (ed25519.PrivateKey, error)
LoadPrivateKeyFromBytes 从[]byte中读取pem格式的公钥断言为ed25519.PrivateKey
func LoadPrivateKeyFromFile ¶
func LoadPrivateKeyFromFile(filePath string) (ed25519.PrivateKey, error)
LoadPrivateKeyFromFile 从文件读取ed25519私钥
func LoadPublicKeyFromBytes ¶
LoadPublicKeyFromBytes 从[]byte中读取pem格式的公钥断言为ed25519.PublicKey
func LoadPublicKeyFromFile ¶
LoadPublicKeyFromFile 从文件读取ed25519公钥
func LoadRequestFromFile ¶
func SaveLicenseToFile ¶
func SaveOffAuthToFile ¶
func SavePrivateKeyToFile ¶
func SavePrivateKeyToFile(privateKey ed25519.PrivateKey, filePath string) error
SavePrivateKeyToFile 将ed25519私钥保存到文件(PEM格式)
func SavePublicKeyToFile ¶
SavePublicKeyToFile 将ed25519公钥保存到文件(PEM格式)
func VerifyLicense ¶
func VerifyLicenseType1 ¶
验证License type1
Types ¶
type License ¶
type License struct {
MachineFingerprint string `json:"machine_fingerprint"` // 机器指纹
IssueDate string `json:"issue_date"` // 签发日期
ExpireDate string `json:"expire_date"` // 截至日期
Customer string `json:"customer,omitempty"` // 客户
Signature string `json:"signature,omitempty"` // 签名
}
func GenerateLicense ¶
func LoadLicenseFromFile ¶
func LoadLicenseFromFileType1 ¶
LoadLicenseFromFileType1 从文件中读取并返回License
func LoadLicenseFromFileType2 ¶
LoadLicenseFromFileType2 从文件中读取并返回License,等同于GetMachineFingerprintType1
type OffAuth ¶
type OffAuth struct {
MachineFingerprint machinecode.MachineCode `json:"machine_fingerprint"` // 机器指纹
IssueDate string `json:"issue_date"` // 签发日期
ExpireDate string `json:"expire_date"` // 截至日期
Customer string `json:"customer"` // 客户
Signature string `json:"signature"` // 签名
}
func GenerateOffAuth ¶
func GenerateOffAuth(machineFingerprint *machinecode.MachineCode, customer string, validDays int, privateKey ed25519.PrivateKey) (*OffAuth, error)
func LoadOffAuthFromFile ¶
Click to show internal directories.
Click to hide internal directories.