Revert "service: add owner key to a signed payload of SessionToken"
This reverts commit 1896264f
This commit is contained in:
parent
abbb6e0e93
commit
22af538c98
2 changed files with 3 additions and 32 deletions
|
@ -174,11 +174,11 @@ func NewVerifiedSessionToken(token SessionToken) DataWithSignature {
|
|||
}
|
||||
}
|
||||
|
||||
func tokenInfoSize(v SessionTokenInfo) int {
|
||||
func tokenInfoSize(v SessionKeySource) int {
|
||||
if v == nil {
|
||||
return 0
|
||||
}
|
||||
return fixedTokenDataSize + len(v.GetSessionKey()) + len(v.GetOwnerKey())
|
||||
return fixedTokenDataSize + len(v.GetSessionKey())
|
||||
}
|
||||
|
||||
// Fills passed buffer with signing token information bytes.
|
||||
|
@ -208,9 +208,7 @@ func copyTokenSignedData(buf []byte, token SessionTokenInfo) {
|
|||
tokenEndianness.PutUint64(buf[off:], token.ExpirationEpoch())
|
||||
off += 8
|
||||
|
||||
off += copy(buf[off:], token.GetSessionKey())
|
||||
|
||||
copy(buf[off:], token.GetOwnerKey())
|
||||
copy(buf[off:], token.GetSessionKey())
|
||||
}
|
||||
|
||||
// SignedData concatenates signed data with session token information. Returns concatenation result.
|
||||
|
|
|
@ -77,16 +77,6 @@ func TestTokenGettersSetters(t *testing.T) {
|
|||
require.Equal(t, key, tok.GetSessionKey())
|
||||
}
|
||||
|
||||
{
|
||||
key := make([]byte, 10)
|
||||
_, err := rand.Read(key)
|
||||
require.NoError(t, err)
|
||||
|
||||
tok.SetOwnerKey(key)
|
||||
|
||||
require.Equal(t, key, tok.GetOwnerKey())
|
||||
}
|
||||
|
||||
{ // Signature
|
||||
sig := make([]byte, 10)
|
||||
_, err := rand.Read(sig)
|
||||
|
@ -136,11 +126,6 @@ func TestSignToken(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
token.SetSessionKey(sessionKey)
|
||||
|
||||
ownerKey := make([]byte, 10)
|
||||
_, err = rand.Read(ownerKey[:])
|
||||
require.NoError(t, err)
|
||||
token.SetOwnerKey(ownerKey)
|
||||
|
||||
signedToken := NewSignedSessionToken(token)
|
||||
verifiedToken := NewVerifiedSessionToken(token)
|
||||
|
||||
|
@ -226,18 +211,6 @@ func TestSignToken(t *testing.T) {
|
|||
token.SetSessionKey(sessionKey)
|
||||
},
|
||||
},
|
||||
{ // Owner key
|
||||
corrupt: func() {
|
||||
ownerKey := token.GetOwnerKey()
|
||||
ownerKey[0]++
|
||||
token.SetOwnerKey(ownerKey)
|
||||
},
|
||||
restore: func() {
|
||||
ownerKey := token.GetOwnerKey()
|
||||
ownerKey[0]--
|
||||
token.SetOwnerKey(ownerKey)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, v := range items {
|
||||
|
|
Loading…
Reference in a new issue