1package saml
2
3import (
4	"crypto/rand"
5	"io"
6	"time"
7
8	dsig "github.com/russellhaering/goxmldsig"
9)
10
11// TimeNow is a function that returns the current time. The default
12// value is time.Now, but it can be replaced for testing.
13var TimeNow = func() time.Time { return time.Now().UTC() }
14
15// Clock is assigned to dsig validation and signing contexts if it is
16// not nil, otherwise the default clock is used.
17var Clock *dsig.Clock
18
19// RandReader is the io.Reader that produces cryptographically random
20// bytes when they are need by the library. The default value is
21// rand.Reader, but it can be replaced for testing.
22var RandReader = rand.Reader
23
24func randomBytes(n int) []byte {
25	rv := make([]byte, n)
26
27	if _, err := io.ReadFull(RandReader, rv); err != nil {
28		panic(err)
29	}
30	return rv
31}
32