mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-11 16:17:39 +02:00
internal/cryptutil: fixed panic on nil pubkey
This commit is contained in:
parent
22fb3a0f7e
commit
c5bcc9bbef
5 changed files with 81 additions and 13 deletions
|
@ -70,11 +70,7 @@ func NewCipher(secret []byte) (*XChaCha20Cipher, error) {
|
|||
// GenerateNonce generates a random nonce.
|
||||
// Panics if source of randomness fails.
|
||||
func (c *XChaCha20Cipher) GenerateNonce() []byte {
|
||||
nonce := make([]byte, c.aead.NonceSize())
|
||||
if _, err := rand.Read(nonce); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return nonce
|
||||
return randomBytes(c.aead.NonceSize())
|
||||
}
|
||||
|
||||
// Encrypt a value using XChaCha20-Poly1305
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue