Browse Source

Use hex instead of base64 encoding for server secret values
* Avoids complications with passing values in URLs, etc.

Rod Hynes 10 years ago
parent
commit
865699cc67
1 changed files with 3 additions and 2 deletions
  1. 3 2
      psiphon/utils.go

+ 3 - 2
psiphon/utils.go

@@ -54,6 +54,7 @@ import (
 	"crypto/tls"
 	"crypto/x509"
 	"encoding/base64"
+	"encoding/hex"
 	"errors"
 	"fmt"
 	"math/big"
@@ -150,14 +151,14 @@ func MakeRandomPeriod(min, max time.Duration) (duration time.Duration) {
 	return
 }
 
-// MakeRandomString returns a base64 encoded random string. byteLength
+// MakeRandomString returns a hex encoded random string. byteLength
 // specifies the pre-encoded data length.
 func MakeRandomString(byteLength int) (string, error) {
 	bytes, err := MakeSecureRandomBytes(byteLength)
 	if err != nil {
 		return "", ContextError(err)
 	}
-	return base64.RawStdEncoding.EncodeToString(bytes), nil
+	return hex.EncodeToString(bytes), nil
 }
 
 func DecodeCertificate(encodedCertificate string) (certificate *x509.Certificate, err error) {