Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/flushcommon/syncmgr/pack_writer_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package syncmgr

import (
"context"
"encoding/base64"
"math"

"github.com/apache/arrow/go/v17/arrow/array"
Expand Down Expand Up @@ -167,7 +168,7 @@ func (bw *BulkPackWriterV2) writeInserts(ctx context.Context, pack *SyncPack) (m
pluginContext := indexcgopb.StoragePluginContext{
EncryptionZoneId: ez.EzID,
CollectionId: ez.CollectionID,
EncryptionKey: string(unsafe),
EncryptionKey: base64.StdEncoding.EncodeToString(unsafe),
}
pluginContextPtr = &pluginContext
}
Expand Down
3 changes: 2 additions & 1 deletion internal/querynodev2/segments/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package segments

import (
"encoding/base64"
"fmt"
"sync"

Expand Down Expand Up @@ -398,7 +399,7 @@ func putOrUpdateStorageContext(properties []*commonpb.KeyValuePair, collectionID
ez := hookutil.GetEzByCollProperties(properties, collectionID)
if ez != nil {
key := hookutil.GetCipher().GetUnsafeKey(ez.EzID, ez.CollectionID)
err := segcore.PutOrRefPluginContext(ez, string(key))
err := segcore.PutOrRefPluginContext(ez, base64.StdEncoding.EncodeToString(key))
if err != nil {
log.Error("failed to put or update plugin context", zap.Int64("collectionID", collectionID), zap.Error(err))
}
Expand Down
5 changes: 3 additions & 2 deletions internal/storage/rw.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package storage

import (
"context"
"encoding/base64"
"fmt"
sio "io"
"sort"
Expand Down Expand Up @@ -253,7 +254,7 @@ func NewBinlogRecordReader(ctx context.Context, binlogs []*datapb.FieldBinlog, s
pluginContext = &indexcgopb.StoragePluginContext{
EncryptionZoneId: ez.EzID,
CollectionId: ez.CollectionID,
EncryptionKey: string(unsafe),
EncryptionKey: base64.StdEncoding.EncodeToString(unsafe),
}
}
}
Expand Down Expand Up @@ -326,7 +327,7 @@ func NewBinlogRecordWriter(ctx context.Context, collectionID, partitionID, segme
pluginContext = &indexcgopb.StoragePluginContext{
EncryptionZoneId: ez.EzID,
CollectionId: ez.CollectionID,
EncryptionKey: string(unsafe),
EncryptionKey: base64.StdEncoding.EncodeToString(unsafe),
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion internal/util/hookutil/cipher.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package hookutil
import (
"bytes"
"context"
"encoding/base64"
"fmt"
"plugin"
"strconv"
Expand Down Expand Up @@ -132,7 +133,7 @@ func GetStoragePluginContext(properties []*commonpb.KeyValuePair, collectionID i
},
{
Key: CipherConfigUnsafeEZK,
Value: string(key),
Value: base64.StdEncoding.EncodeToString(key),
},
}
return pluginContext
Expand Down
3 changes: 2 additions & 1 deletion internal/util/hookutil/cipher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package hookutil

import (
"context"
"encoding/base64"
"fmt"
"sync"
"testing"
Expand Down Expand Up @@ -243,7 +244,7 @@ func (s *CipherSuite) TestGetStoragePluginContext() {
s.Equal(CipherConfigCreateEZ, result[0].Key)
s.Equal("1", result[0].Value)
s.Equal(CipherConfigUnsafeEZK, result[1].Key)
s.Equal("unsafe key", result[1].Value)
s.Equal(base64.StdEncoding.EncodeToString([]byte("unsafe key")), result[1].Value)

result = GetStoragePluginContext([]*commonpb.KeyValuePair{}, 2)
s.Nil(result)
Expand Down
Loading