2021-11-25 01:56:58 +00:00
|
|
|
package storage
|
|
|
|
|
|
|
|
import (
|
2022-11-25 12:44:55 +00:00
|
|
|
"bytes"
|
2021-11-25 01:56:58 +00:00
|
|
|
"context"
|
|
|
|
"crypto/sha256"
|
2022-11-25 12:44:55 +00:00
|
|
|
"database/sql"
|
|
|
|
"errors"
|
2021-11-25 01:56:58 +00:00
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/google/uuid"
|
|
|
|
"github.com/jmoiron/sqlx"
|
|
|
|
|
|
|
|
"github.com/authelia/authelia/v4/internal/utils"
|
|
|
|
)
|
|
|
|
|
|
|
|
// SchemaEncryptionChangeKey uses the currently configured key to decrypt values in the database and the key provided
|
|
|
|
// by this command to encrypt the values again and update them using a transaction.
|
2022-11-25 12:44:55 +00:00
|
|
|
func (p *SQLProvider) SchemaEncryptionChangeKey(ctx context.Context, key string) (err error) {
|
|
|
|
skey := sha256.Sum256([]byte(key))
|
|
|
|
|
|
|
|
if bytes.Equal(skey[:], p.key[:]) {
|
|
|
|
return fmt.Errorf("error changing the storage encryption key: the old key and the new key are the same")
|
|
|
|
}
|
|
|
|
|
|
|
|
if _, err = p.SchemaEncryptionCheckKey(ctx, false); err != nil {
|
|
|
|
return fmt.Errorf("error changing the storage encryption key: %w", err)
|
|
|
|
}
|
|
|
|
|
2021-11-25 01:56:58 +00:00
|
|
|
tx, err := p.db.Beginx()
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("error beginning transaction to change encryption key: %w", err)
|
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
encChangeFuncs := []EncryptionChangeKeyFunc{
|
|
|
|
schemaEncryptionChangeKeyTOTP,
|
|
|
|
schemaEncryptionChangeKeyWebauthn,
|
|
|
|
}
|
2021-11-25 01:56:58 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
for i := 0; true; i++ {
|
|
|
|
typeOAuth2Session := OAuth2SessionType(i)
|
|
|
|
|
|
|
|
if typeOAuth2Session.Table() == "" {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
|
|
|
|
encChangeFuncs = append(encChangeFuncs, schemaEncryptionChangeKeyOpenIDConnect(typeOAuth2Session))
|
2021-12-03 00:04:11 +00:00
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
for _, encChangeFunc := range encChangeFuncs {
|
|
|
|
if err = encChangeFunc(ctx, p, tx, skey); err != nil {
|
|
|
|
if rerr := tx.Rollback(); rerr != nil {
|
|
|
|
return fmt.Errorf("rollback error %v: rollback due to error: %w", rerr, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return fmt.Errorf("rollback due to error: %w", err)
|
|
|
|
}
|
2021-12-03 00:04:11 +00:00
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if err = p.setNewEncryptionCheckValue(ctx, tx, &skey); err != nil {
|
|
|
|
if rerr := tx.Rollback(); rerr != nil {
|
|
|
|
return fmt.Errorf("rollback error %v: rollback due to error: %w", rerr, err)
|
2021-12-03 00:04:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return fmt.Errorf("rollback due to error: %w", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return tx.Commit()
|
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
// SchemaEncryptionCheckKey checks the encryption key configured is valid for the database.
|
|
|
|
func (p *SQLProvider) SchemaEncryptionCheckKey(ctx context.Context, verbose bool) (result EncryptionValidationResult, err error) {
|
|
|
|
version, err := p.SchemaVersion(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return result, err
|
|
|
|
}
|
2021-11-25 01:56:58 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if version < 1 {
|
|
|
|
return result, ErrSchemaEncryptionVersionUnsupported
|
|
|
|
}
|
2021-11-25 01:56:58 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
result = EncryptionValidationResult{
|
|
|
|
Tables: map[string]EncryptionValidationTableResult{},
|
|
|
|
}
|
2021-11-25 01:56:58 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if _, err = p.getEncryptionValue(ctx, encryptionNameCheck); err != nil {
|
|
|
|
result.InvalidCheckValue = true
|
|
|
|
}
|
2021-11-25 01:56:58 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if verbose {
|
|
|
|
encCheckFuncs := []EncryptionCheckKeyFunc{
|
|
|
|
schemaEncryptionCheckKeyTOTP,
|
|
|
|
schemaEncryptionCheckKeyWebauthn,
|
|
|
|
}
|
2021-11-25 01:56:58 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
for i := 0; true; i++ {
|
|
|
|
typeOAuth2Session := OAuth2SessionType(i)
|
2021-11-25 01:56:58 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if typeOAuth2Session.Table() == "" {
|
|
|
|
break
|
2021-11-25 01:56:58 +00:00
|
|
|
}
|
2022-11-25 12:44:55 +00:00
|
|
|
|
|
|
|
encCheckFuncs = append(encCheckFuncs, schemaEncryptionCheckKeyOpenIDConnect(typeOAuth2Session))
|
2021-11-25 01:56:58 +00:00
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
for _, encCheckFunc := range encCheckFuncs {
|
|
|
|
table, tableResult := encCheckFunc(ctx, p)
|
|
|
|
|
|
|
|
result.Tables[table] = tableResult
|
2021-11-25 01:56:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
return result, nil
|
2021-12-03 00:04:11 +00:00
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
func schemaEncryptionChangeKeyTOTP(ctx context.Context, provider *SQLProvider, tx *sqlx.Tx, key [32]byte) (err error) {
|
|
|
|
var count int
|
2021-12-03 00:04:11 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if err = tx.GetContext(ctx, &count, fmt.Sprintf(queryFmtSelectRowCount, tableTOTPConfigurations)); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-12-03 00:04:11 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if count == 0 {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
configs := make([]encTOTPConfiguration, 0, count)
|
|
|
|
|
|
|
|
if err = tx.SelectContext(ctx, &configs, fmt.Sprintf(queryFmtSelectTOTPConfigurationsEncryptedData, tableTOTPConfigurations)); err != nil {
|
|
|
|
if errors.Is(err, sql.ErrNoRows) {
|
|
|
|
return nil
|
2021-11-25 01:56:58 +00:00
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
return fmt.Errorf("error selecting TOTP configurations: %w", err)
|
|
|
|
}
|
2021-12-03 00:04:11 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
query := provider.db.Rebind(fmt.Sprintf(queryFmtUpdateTOTPConfigurationSecret, tableTOTPConfigurations))
|
2021-12-03 00:04:11 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
for _, c := range configs {
|
|
|
|
if c.Secret, err = provider.decrypt(c.Secret); err != nil {
|
|
|
|
return fmt.Errorf("error decrypting TOTP configuration secret with id '%d': %w", c.ID, err)
|
|
|
|
}
|
2021-12-03 00:04:11 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if c.Secret, err = utils.Encrypt(c.Secret, &key); err != nil {
|
|
|
|
return fmt.Errorf("error encrypting TOTP configuration secret with id '%d': %w", c.ID, err)
|
2021-12-03 00:04:11 +00:00
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if _, err = tx.ExecContext(ctx, query, c.Secret, c.ID); err != nil {
|
|
|
|
return fmt.Errorf("error updating TOTP configuration secret with id '%d': %w", c.ID, err)
|
2021-12-03 00:04:11 +00:00
|
|
|
}
|
2021-11-25 01:56:58 +00:00
|
|
|
}
|
|
|
|
|
2021-12-03 00:04:11 +00:00
|
|
|
return nil
|
2021-11-25 01:56:58 +00:00
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
func schemaEncryptionChangeKeyWebauthn(ctx context.Context, provider *SQLProvider, tx *sqlx.Tx, key [32]byte) (err error) {
|
|
|
|
var count int
|
|
|
|
|
|
|
|
if err = tx.GetContext(ctx, &count, fmt.Sprintf(queryFmtSelectRowCount, tableWebauthnDevices)); err != nil {
|
2021-11-25 01:56:58 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if count == 0 {
|
|
|
|
return nil
|
2021-11-25 01:56:58 +00:00
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
devices := make([]encWebauthnDevice, 0, count)
|
2021-11-25 01:56:58 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if err = tx.SelectContext(ctx, &devices, fmt.Sprintf(queryFmtSelectWebauthnDevicesEncryptedData, tableWebauthnDevices)); err != nil {
|
|
|
|
if errors.Is(err, sql.ErrNoRows) {
|
|
|
|
return nil
|
2021-12-03 00:04:11 +00:00
|
|
|
}
|
2021-11-25 01:56:58 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
return fmt.Errorf("error selecting Webauthn devices: %w", err)
|
2021-12-03 00:04:11 +00:00
|
|
|
}
|
2021-11-25 01:56:58 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
query := provider.db.Rebind(fmt.Sprintf(queryFmtUpdateWebauthnDevicePublicKey, tableWebauthnDevices))
|
2021-11-25 01:56:58 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
for _, d := range devices {
|
|
|
|
if d.PublicKey, err = provider.decrypt(d.PublicKey); err != nil {
|
|
|
|
return fmt.Errorf("error decrypting Webauthn device public key with id '%d': %w", d.ID, err)
|
|
|
|
}
|
2021-11-25 01:56:58 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if d.PublicKey, err = utils.Encrypt(d.PublicKey, &key); err != nil {
|
|
|
|
return fmt.Errorf("error encrypting Webauthn device public key with id '%d': %w", d.ID, err)
|
2021-12-03 00:04:11 +00:00
|
|
|
}
|
2021-11-25 01:56:58 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if _, err = tx.ExecContext(ctx, query, d.PublicKey, d.ID); err != nil {
|
|
|
|
return fmt.Errorf("error updating Webauthn device public key with id '%d': %w", d.ID, err)
|
|
|
|
}
|
2021-12-03 00:04:11 +00:00
|
|
|
}
|
2021-11-25 01:56:58 +00:00
|
|
|
|
2021-12-03 00:04:11 +00:00
|
|
|
return nil
|
|
|
|
}
|
2021-11-25 01:56:58 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
func schemaEncryptionChangeKeyOpenIDConnect(typeOAuth2Session OAuth2SessionType) EncryptionChangeKeyFunc {
|
|
|
|
return func(ctx context.Context, provider *SQLProvider, tx *sqlx.Tx, key [32]byte) (err error) {
|
|
|
|
var count int
|
2021-11-25 01:56:58 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if err = tx.GetContext(ctx, &count, fmt.Sprintf(queryFmtSelectRowCount, typeOAuth2Session.Table())); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-12-03 00:04:11 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if count == 0 {
|
|
|
|
return nil
|
|
|
|
}
|
2021-12-03 00:04:11 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
sessions := make([]encOAuth2Session, 0, count)
|
2021-11-25 01:56:58 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if err = tx.SelectContext(ctx, &sessions, fmt.Sprintf(queryFmtSelectOAuth2SessionEncryptedData, typeOAuth2Session.Table())); err != nil {
|
|
|
|
return fmt.Errorf("error selecting oauth2 %s sessions: %w", typeOAuth2Session.String(), err)
|
2021-12-03 00:04:11 +00:00
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
query := provider.db.Rebind(fmt.Sprintf(queryFmtUpdateOAuth2ConsentSessionSessionData, typeOAuth2Session.Table()))
|
2021-12-03 00:04:11 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
for _, s := range sessions {
|
|
|
|
if s.Session, err = provider.decrypt(s.Session); err != nil {
|
|
|
|
return fmt.Errorf("error decrypting oauth2 %s session data with id '%d': %w", typeOAuth2Session.String(), s.ID, err)
|
|
|
|
}
|
2021-12-03 00:04:11 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if s.Session, err = utils.Encrypt(s.Session, &key); err != nil {
|
|
|
|
return fmt.Errorf("error encrypting oauth2 %s session data with id '%d': %w", typeOAuth2Session.String(), s.ID, err)
|
2021-12-03 00:04:11 +00:00
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if _, err = tx.ExecContext(ctx, query, s.Session, s.ID); err != nil {
|
|
|
|
return fmt.Errorf("error updating oauth2 %s session data with id '%d': %w", typeOAuth2Session.String(), s.ID, err)
|
2021-11-25 01:56:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
2021-12-03 00:04:11 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
func schemaEncryptionCheckKeyTOTP(ctx context.Context, provider *SQLProvider) (table string, result EncryptionValidationTableResult) {
|
|
|
|
var (
|
|
|
|
rows *sqlx.Rows
|
|
|
|
err error
|
|
|
|
)
|
|
|
|
|
|
|
|
if rows, err = provider.db.QueryxContext(ctx, fmt.Sprintf(queryFmtSelectTOTPConfigurationsEncryptedData, tableTOTPConfigurations)); err != nil {
|
|
|
|
return tableTOTPConfigurations, EncryptionValidationTableResult{Error: fmt.Errorf("error selecting TOTP configurations: %w", err)}
|
2021-11-25 01:56:58 +00:00
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
var config encTOTPConfiguration
|
|
|
|
|
|
|
|
for rows.Next() {
|
|
|
|
result.Total++
|
|
|
|
|
|
|
|
if err = rows.StructScan(&config); err != nil {
|
|
|
|
_ = rows.Close()
|
|
|
|
|
|
|
|
return tableTOTPConfigurations, EncryptionValidationTableResult{Error: fmt.Errorf("error scanning TOTP configuration to struct: %w", err)}
|
|
|
|
}
|
|
|
|
|
|
|
|
if _, err = provider.decrypt(config.Secret); err != nil {
|
|
|
|
result.Invalid++
|
|
|
|
}
|
2021-12-03 00:04:11 +00:00
|
|
|
}
|
2021-11-25 01:56:58 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
_ = rows.Close()
|
|
|
|
|
|
|
|
return tableTOTPConfigurations, result
|
2021-12-03 00:04:11 +00:00
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
func schemaEncryptionCheckKeyWebauthn(ctx context.Context, provider *SQLProvider) (table string, result EncryptionValidationTableResult) {
|
2021-12-03 00:04:11 +00:00
|
|
|
var (
|
2022-11-25 12:44:55 +00:00
|
|
|
rows *sqlx.Rows
|
|
|
|
err error
|
2021-12-03 00:04:11 +00:00
|
|
|
)
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if rows, err = provider.db.QueryxContext(ctx, fmt.Sprintf(queryFmtSelectWebauthnDevicesEncryptedData, tableWebauthnDevices)); err != nil {
|
|
|
|
return tableWebauthnDevices, EncryptionValidationTableResult{Error: fmt.Errorf("error selecting Webauthn devices: %w", err)}
|
|
|
|
}
|
|
|
|
|
|
|
|
var device encWebauthnDevice
|
2021-12-03 00:04:11 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
for rows.Next() {
|
|
|
|
result.Total++
|
2021-12-03 00:04:11 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if err = rows.StructScan(&device); err != nil {
|
2021-12-03 00:04:11 +00:00
|
|
|
_ = rows.Close()
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
return tableWebauthnDevices, EncryptionValidationTableResult{Error: fmt.Errorf("error scanning Webauthn device to struct: %w", err)}
|
|
|
|
}
|
|
|
|
|
|
|
|
if _, err = provider.decrypt(device.PublicKey); err != nil {
|
|
|
|
result.Invalid++
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_ = rows.Close()
|
|
|
|
|
|
|
|
return tableWebauthnDevices, result
|
|
|
|
}
|
|
|
|
|
|
|
|
func schemaEncryptionCheckKeyOpenIDConnect(typeOAuth2Session OAuth2SessionType) EncryptionCheckKeyFunc {
|
|
|
|
return func(ctx context.Context, provider *SQLProvider) (table string, result EncryptionValidationTableResult) {
|
|
|
|
var (
|
|
|
|
rows *sqlx.Rows
|
|
|
|
err error
|
|
|
|
)
|
|
|
|
|
|
|
|
if rows, err = provider.db.QueryxContext(ctx, fmt.Sprintf(queryFmtSelectOAuth2SessionEncryptedData, typeOAuth2Session.Table())); err != nil {
|
|
|
|
return typeOAuth2Session.Table(), EncryptionValidationTableResult{Error: fmt.Errorf("error selecting oauth2 %s sessions: %w", typeOAuth2Session.String(), err)}
|
2021-12-03 00:04:11 +00:00
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
var session encOAuth2Session
|
2021-12-03 00:04:11 +00:00
|
|
|
|
|
|
|
for rows.Next() {
|
2022-11-25 12:44:55 +00:00
|
|
|
result.Total++
|
2021-12-03 00:04:11 +00:00
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if err = rows.StructScan(&session); err != nil {
|
2021-12-03 00:04:11 +00:00
|
|
|
_ = rows.Close()
|
2022-11-25 12:44:55 +00:00
|
|
|
|
|
|
|
return typeOAuth2Session.Table(), EncryptionValidationTableResult{Error: fmt.Errorf("error scanning oauth2 %s session to struct: %w", typeOAuth2Session.String(), err)}
|
2021-11-25 01:56:58 +00:00
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
if _, err = provider.decrypt(session.Session); err != nil {
|
|
|
|
result.Invalid++
|
2021-12-03 00:04:11 +00:00
|
|
|
}
|
2021-11-25 01:56:58 +00:00
|
|
|
}
|
|
|
|
|
2021-12-03 00:04:11 +00:00
|
|
|
_ = rows.Close()
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
return typeOAuth2Session.Table(), result
|
2021-11-25 01:56:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-03 01:51:02 +00:00
|
|
|
func (p *SQLProvider) encrypt(clearText []byte) (cipherText []byte, err error) {
|
2021-11-25 01:56:58 +00:00
|
|
|
return utils.Encrypt(clearText, &p.key)
|
|
|
|
}
|
|
|
|
|
2022-09-03 01:51:02 +00:00
|
|
|
func (p *SQLProvider) decrypt(cipherText []byte) (clearText []byte, err error) {
|
2021-11-25 01:56:58 +00:00
|
|
|
return utils.Decrypt(cipherText, &p.key)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *SQLProvider) getEncryptionValue(ctx context.Context, name string) (value []byte, err error) {
|
|
|
|
var encryptedValue []byte
|
|
|
|
|
|
|
|
err = p.db.GetContext(ctx, &encryptedValue, p.sqlSelectEncryptionValue, name)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return p.decrypt(encryptedValue)
|
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
func (p *SQLProvider) setNewEncryptionCheckValue(ctx context.Context, conn SQLXConnection, key *[32]byte) (err error) {
|
2022-03-16 00:29:46 +00:00
|
|
|
valueClearText, err := uuid.NewRandom()
|
2021-12-04 04:48:22 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-11-25 01:56:58 +00:00
|
|
|
|
|
|
|
value, err := utils.Encrypt([]byte(valueClearText.String()), key)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2022-11-25 12:44:55 +00:00
|
|
|
_, err = conn.ExecContext(ctx, p.sqlUpsertEncryptionValue, encryptionNameCheck, value)
|
2021-11-25 01:56:58 +00:00
|
|
|
|
|
|
|
return err
|
|
|
|
}
|