offauth

package
v0.0.0-...-0fa8407 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRequestFileType1

func GenerateRequestFileType1(reqFileName string) error

GenerateRequestFileType1 生成请求文件类型1,将machinecode.MachineCode转为字符串然后做base64编码

func GetMachineFingerprintType1

func GetMachineFingerprintType1() (string, error)

将machinecode.MachineCode转为字符串然后做base64编码

func GetMachineFingerprintType2

func GetMachineFingerprintType2() (string, error)

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

func LoadPublicKeyFromBytes(content []byte) (ed25519.PublicKey, error)

LoadPublicKeyFromBytes 从[]byte中读取pem格式的公钥断言为ed25519.PublicKey

func LoadPublicKeyFromFile

func LoadPublicKeyFromFile(filePath string) (ed25519.PublicKey, error)

LoadPublicKeyFromFile 从文件读取ed25519公钥

func LoadRequestFromFile

func LoadRequestFromFile(filename string) (string, error)

func SaveLicenseToFile

func SaveLicenseToFile(license *License, filename string) error

func SaveOffAuthToFile

func SaveOffAuthToFile(offAuth *OffAuth, filename string) error

func SavePrivateKeyToFile

func SavePrivateKeyToFile(privateKey ed25519.PrivateKey, filePath string) error

SavePrivateKeyToFile 将ed25519私钥保存到文件(PEM格式)

func SavePublicKeyToFile

func SavePublicKeyToFile(publicKey ed25519.PublicKey, filePath string) error

SavePublicKeyToFile 将ed25519公钥保存到文件(PEM格式)

func VerifyLicense

func VerifyLicense(license *License, publicKey ed25519.PublicKey) (bool, error)

func VerifyLicenseType1

func VerifyLicenseType1(license *License, publicKey ed25519.PublicKey) (bool, error)

验证License type1

func VerifyOffAuth

func VerifyOffAuth(offAuth *OffAuth, publicKey ed25519.PublicKey) (bool, error)

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 GenerateLicense(machineFingerprint, customer string, validDays int, privateKey ed25519.PrivateKey) (*License, error)

func LoadLicenseFromFile

func LoadLicenseFromFile(filename string) (*License, error)

func LoadLicenseFromFileType1

func LoadLicenseFromFileType1(filename string) (*License, error)

LoadLicenseFromFileType1 从文件中读取并返回License

func LoadLicenseFromFileType2

func LoadLicenseFromFileType2(filename string) (*License, error)

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

func LoadOffAuthFromFile(filename string) (*OffAuth, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL