mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-09 21:08:11 +02:00
internal/cryputil: combines aead and cryptutil packages.
- Refactored encrypt / decrypt methods to use aead's NonceSize() interface method. - Add explicit GenerateKey function. - Remove mutex on XChaCha20.
This commit is contained in:
parent
131810ccfe
commit
24b11b0428
11 changed files with 44 additions and 89 deletions
|
@ -7,7 +7,7 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/pomerium/pomerium/internal/aead"
|
||||
"github.com/pomerium/pomerium/internal/cryptutil"
|
||||
)
|
||||
|
||||
// ErrInvalidSession is an error for invalid sessions.
|
||||
|
@ -36,14 +36,14 @@ type CookieStore struct {
|
|||
CookieSecure bool
|
||||
CookieHTTPOnly bool
|
||||
CookieDomain string
|
||||
CookieCipher aead.Cipher
|
||||
CookieCipher cryptutil.Cipher
|
||||
SessionLifetimeTTL time.Duration
|
||||
}
|
||||
|
||||
// CreateMiscreantCookieCipher creates a new miscreant cipher with the cookie secret
|
||||
func CreateMiscreantCookieCipher(cookieSecret []byte) func(s *CookieStore) error {
|
||||
return func(s *CookieStore) error {
|
||||
cipher, err := aead.New(cookieSecret)
|
||||
cipher, err := cryptutil.NewCipher(cookieSecret)
|
||||
if err != nil {
|
||||
return fmt.Errorf("miscreant cookie-secret error: %s", err.Error())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue