traffic.go 737 B

1234567891011121314151617181920212223242526272829
  1. package logic
  2. import (
  3. "crypto/rsa"
  4. "fmt"
  5. "math/big"
  6. )
  7. // RetrievePrivateTrafficKey - retrieves private key of server
  8. func RetrievePrivateTrafficKey() (rsa.PrivateKey, error) {
  9. var telRecord, err = fetchTelemetryRecord()
  10. if err != nil {
  11. return rsa.PrivateKey{}, err
  12. }
  13. fmt.Printf("fetched priv key %v \n", telRecord.TrafficKeyPriv)
  14. return telRecord.TrafficKeyPriv, nil
  15. }
  16. // RetrievePublicTrafficKey - retrieves public key of server
  17. func RetrievePublicTrafficKey() (rsa.PublicKey, big.Int, error) {
  18. var telRecord, err = fetchTelemetryRecord()
  19. if err != nil {
  20. return rsa.PublicKey{}, big.Int{}, err
  21. }
  22. fmt.Printf("fetched pub key %v \n", telRecord.TrafficKeyPub)
  23. return telRecord.TrafficKeyPub, telRecord.PubMod, nil
  24. }