Commit graph

66 commits

Author SHA1 Message Date
Leonard Lyubich
5e1e220988 service: sign requests on the principle of Matryoshka
This commit changes SignRequestData / VerifyRequestData functions to
add the list of previous public keys to a signed message for all
requests.
2020-06-22 17:26:59 +03:00
Leonard Lyubich
a3c4889945 service: implement BearerToken interface on BearerTokenMsg message
This commit:

  * implements (Set)ExpirationEpoch methods on BearerTokenMsg;

  * removes BearerTokenMsg wrapper.
2020-06-18 16:08:44 +03:00
Leonard Lyubich
c360b7d19c service: add ExtendedHeader list to signed payload of the requests 2020-06-18 15:50:01 +03:00
Leonard Lyubich
db53e2ea39 service: make RequestData to provide ExtendedHeadersSource interface 2020-06-18 15:47:55 +03:00
Leonard Lyubich
a3569ad99e service: ad BearerToken to signed payload of the requests 2020-06-18 15:28:58 +03:00
Leonard Lyubich
3f7d3f8a86 service: make RequestData to provide BearerTokenSource interface 2020-06-18 15:24:17 +03:00
Leonard Lyubich
ee584f325c Update to neofs-api v1.1.0 2020-06-18 15:01:25 +03:00
Leonard Lyubich
705582dbc7 service: define request X-headers interface 2020-06-18 14:41:44 +03:00
Leonard Lyubich
55c3b714c0 service: define BearerToken interface 2020-06-18 14:37:42 +03:00
Leonard Lyubich
74e917810a service: support broken apart signable payload of the requests
In previous implementation service package provided types and functions
that wrapped signing/verification of data with session token.
This allowed us to use these functions for signing / verification of
service requests of other packages. To support the expansion of messages
with additional parts that need to be signed, you must be able to easily
expand the signed data with new parts.

To achieve the described goal, this commit makes the following changes:

  * adds GroupSignedPayloads and GroupVerifyPayloads functions;

  * renames SignedDataWithToken to RequestData, DataWithTokenSignAccumulator
    to RequestSignedData, DataWithTokenSignSource to RequestVerifyData;

  * renames SignDataWithSessionToken/VerifyAccumulatedSignaturesWithToken
    function to SignRequestData/VerifyRequestData and makes it to use
    GroupSignedPayloads/GroupVerifyPayloads internally.
2020-06-10 20:37:10 +03:00
Leonard Lyubich
bd261cf566 service: call OwnerKey setter in AddSignKey method implementation 2020-05-16 15:29:44 +03:00
Leonard Lyubich
22af538c98 Revert "service: add owner key to a signed payload of SessionToken"
This reverts commit 1896264f
2020-05-16 15:28:35 +03:00
Leonard Lyubich
1896264f8c service: add owner key to a signed payload of SessionToken 2020-05-15 16:05:02 +03:00
Leonard Lyubich
bc413f6280 service: defined OwnerKeyContainer and embed it to SessionInfo interface 2020-05-15 16:03:47 +03:00
Leonard Lyubich
c8625b2c86 Update to neofs-api v0.7.5 2020-05-15 16:00:02 +03:00
Leonard Lyubich
0b5c4299aa service: implement SessionToken wrapper for Sign/Verify support 2020-05-13 19:02:13 +03:00
Leonard Lyubich
877db6be32 service: remove no longer used Sign/Verify methods and functions 2020-05-12 10:45:03 +03:00
Leonard Lyubich
b2543c0739 fix comments 2020-05-11 17:44:59 +03:00
Leonard Lyubich
e01fb0cc62 Implement signed data calculating function from SignedDataReader 2020-05-11 17:28:44 +03:00
Leonard Lyubich
9327c5f816 bootstrap: implement SignedDataSource on Request message 2020-05-11 13:57:23 +03:00
Leonard Lyubich
15a55d54a2 fix comments 2020-05-08 12:45:16 +03:00
Leonard Lyubich
b079a7604f session: implement gRPC session creator 2020-05-08 12:34:16 +03:00
Leonard Lyubich
1932658a7d session: implement getters and setters on messages 2020-05-08 11:53:49 +03:00
Leonard Lyubich
d8cc00b54c Update to neofs-api v0.7.4 2020-05-08 10:49:23 +03:00
Leonard Lyubich
65d7c39e1a service: fix comments 2020-05-06 15:32:13 +03:00
Leonard Lyubich
082edf7456 service: implement sign-verify methods on RequestVerificationHeader 2020-05-06 12:50:15 +03:00
Leonard Lyubich
52d3c82776 service: implement sign/verify function for data with session token 2020-05-06 11:44:55 +03:00
Leonard Lyubich
fc2c78ae89 service: use new function for token signing and verification 2020-05-05 14:49:35 +03:00
Leonard Lyubich
74144f207a service: implement functions for verification of signatures 2020-05-05 13:16:21 +03:00
Leonard Lyubich
f3e6caf7e7 service: implement a function for creating and storing a signature 2020-05-04 19:33:18 +03:00
Leonard Lyubich
0ffb1bd61d service: implement a function for signing data 2020-05-04 18:52:56 +03:00
Leonard Lyubich
eb94cf7549 service: refactor MetaHeader interface 2020-05-04 14:37:14 +03:00
Leonard Lyubich
c38a8eddc8 service: use value container interfaces 2020-05-04 14:05:06 +03:00
Leonard Lyubich
8270245455 service: transfer public types to a separate file 2020-05-04 14:00:25 +03:00
Leonard Lyubich
b785eb710a service: transfer TTL code to a separate file 2020-05-04 13:38:27 +03:00
Leonard Lyubich
fc177c4ce3 service: change constant errors
This commit:

  * moves defined errors to a separate file;

  * renames ErrEmptyToken to ErrNilToken;

  * merges ErrZeroTTL and ErrIncorrectTTL into single ErrInvalidTTL.
2020-05-04 13:06:36 +03:00
Leonard Lyubich
cce6566f1e service: prevent NPE in VerifyTokenSignature function
This commit adds next changes to VerifyTokenSignature:

  * returns ErrEmptyToken on nil token argument;

  * returns ErrEmptyPublicKey on nil public key argument.
2020-04-29 10:57:07 +03:00
Leonard Lyubich
82ffde253b service: implement Sign/Verify functions for SessionToken 2020-04-28 19:03:15 +03:00
Leonard Lyubich
c6971d2004 service: access Token message fields through getters and setters 2020-04-28 18:40:21 +03:00
Leonard Lyubich
d327d836c4 service: define and implement Token field composing interface
This commit:

  * defines SessionToken interface of Token field getters/setters group;

  * implements SessionToken on Token message.
2020-04-28 17:09:01 +03:00
Leonard Lyubich
942bedb8ed service: implement Token field setter on RequestVerificationHeader
After recent changes Token field is presented in RequestVerificationHeader.
There is a need to provide an interface of field getter/setter.

This commit:

  * defines TokenHeader interface of token value container;

  * implements Token field setter on RequestVerificationHeader.
2020-04-28 17:02:47 +03:00
Leonard Lyubich
09f8ee52d0 service: implement Raw field setter on RequestMetaHeader struct
After recent changes Raw field is presented in RequestMetaHeader.
There is a need to provide an interface of field getter/setter.

This commit:

  * defines RawHeader interface of raw value container;

  * embeds RawHeader into MetaHeader interface;

  * implements Raw field setter on RequestMetaHeader.
2020-04-28 17:02:47 +03:00
Leonard Lyubich
4ac17201b7 Resolve update conflicts 2020-04-28 13:33:43 +03:00
Leonard Lyubich
e63d112cb2 Update to neofs-api v0.7.2 2020-04-28 12:50:52 +03:00
Evgeniy Kulikov
b118f469d2
Migrate to new repo 2020-03-31 10:05:26 +03:00
Leonard Lyubich
a21e42ea4f Implement Epoch and Version setters on ResponseMetaHeader 2020-02-14 12:17:48 +03:00
Evgeniy Kulikov
de09878df1
Response meta header 2020-02-13 18:10:46 +03:00
Evgeniy Kulikov
49cc731c8d
update proto files, regenerate pb.go 2020-02-05 16:58:06 +03:00
Evgeniy Kulikov
53af48372f
prepare to rename neofs-proto to neofs-api 2020-01-30 16:35:30 +03:00
Evgeniy Kulikov
8d028100e9
service: Use sync pool for Sign/Verify request headers
```
// Before
BenchmarkSignRequestHeader-8   	     146	   8070375 ns/op	 4210607 B/op	      48 allocs/op
BenchmarkVerifyRequestHeader-8   	      14	  83058325 ns/op	42085955 B/op	    1601 allocs/op

// After
BenchmarkSignRequestHeader-8   	     156	   7709172 ns/op	   33902 B/op	      45 allocs/op
BenchmarkVerifyRequestHeader-8   	      15	  76910232 ns/op	   54368 B/op	    1563 allocs/op

// Summary:
benchmark                          old ns/op     new ns/op     delta
BenchmarkSignRequestHeader-8       8070375       7709172       -4.48%
BenchmarkVerifyRequestHeader-8     83058325      76910232      -7.40%

benchmark                          old allocs     new allocs     delta
BenchmarkSignRequestHeader-8       48             45             -6.25%
BenchmarkVerifyRequestHeader-8     1601           1563           -2.37%

benchmark                          old bytes     new bytes     delta
BenchmarkSignRequestHeader-8       4210607       33902         -99.19%
BenchmarkVerifyRequestHeader-8     42085955      54368         -99.87%
```
2019-12-20 17:14:51 +03:00