jrebelsign.go 578 B

1234567891011121314151617181920
  1. package main
  2. import (
  3. "strconv"
  4. )
  5. func toLeaseCreateJson(clientRandomness string, serverRandomness string, guid string, offline bool, validFrom string, validUntil string) (res string) {
  6. var s2 string
  7. if offline {
  8. s2 = clientRandomness + ";" + serverRandomness + ";" + guid + ";" + strconv.FormatBool(offline) + ";" + validFrom + ";" + validUntil
  9. } else {
  10. s2 = clientRandomness + ";" + serverRandomness + ";" + guid + ";" + strconv.FormatBool(offline)
  11. }
  12. signature, err := signWithSha1([]byte(s2))
  13. if err != nil {
  14. return
  15. }
  16. res = encodeBase64(signature)
  17. return
  18. }