From 602ee11123b46dd8131903928c34c5f014d6d601 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 2 Feb 2024 17:56:40 +0300 Subject: [PATCH] [#934] containersvc: Marhal public key in short format for APE Signed-off-by: Evgenii Stratonikov --- pkg/services/container/ape.go | 7 ++++--- pkg/services/container/ape_test.go | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/services/container/ape.go b/pkg/services/container/ape.go index c57e54d08..d1b490bdf 100644 --- a/pkg/services/container/ape.go +++ b/pkg/services/container/ape.go @@ -6,6 +6,7 @@ import ( "crypto/ecdsa" "crypto/elliptic" "crypto/sha256" + "encoding/hex" "errors" "fmt" "strings" @@ -133,7 +134,7 @@ func (ac *apeChecker) List(ctx context.Context, req *container.ListRequest) (*co } reqProps := map[string]string{ - nativeschema.PropertyKeyActorPublicKey: pk.String(), + nativeschema.PropertyKeyActorPublicKey: hex.EncodeToString(pk.Bytes()), nativeschema.PropertyKeyActorRole: role, } @@ -178,7 +179,7 @@ func (ac *apeChecker) Put(ctx context.Context, req *container.PutRequest) (*cont } reqProps := map[string]string{ - nativeschema.PropertyKeyActorPublicKey: pk.String(), + nativeschema.PropertyKeyActorPublicKey: hex.EncodeToString(pk.Bytes()), nativeschema.PropertyKeyActorRole: role, } @@ -391,7 +392,7 @@ func (ac *apeChecker) getRequestProps(mh *session.RequestMetaHeader, vh *session return nil, err } return map[string]string{ - nativeschema.PropertyKeyActorPublicKey: pk.String(), + nativeschema.PropertyKeyActorPublicKey: hex.EncodeToString(pk.Bytes()), nativeschema.PropertyKeyActorRole: role, }, nil } diff --git a/pkg/services/container/ape_test.go b/pkg/services/container/ape_test.go index 5344d9f23..daaacb031 100644 --- a/pkg/services/container/ape_test.go +++ b/pkg/services/container/ape_test.go @@ -3,6 +3,7 @@ package container import ( "context" "crypto/ecdsa" + "encoding/hex" "errors" "fmt" "testing" @@ -524,7 +525,7 @@ func testDenyListContainersForPK(t *testing.T) { { Object: chain.ObjectRequest, Key: nativeschema.PropertyKeyActorPublicKey, - Value: pk.PublicKey().String(), + Value: hex.EncodeToString(pk.PublicKey().Bytes()), Op: chain.CondStringEquals, }, },