Commit graph

23 commits

Author SHA1 Message Date
Evgeniy Kulikov
e9d1b1884c Refactoring for go1.15+
- use elliptic.MarshalCompressed
- use elliptic.UnmarshalCompressed
- for older go versions use old methods
- update dependencies
  - github.com/mr-tron/base58 v1.2.0
  - github.com/pkg/errors v0.9.1
  - github.com/stretchr/testify v1.7.0

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2021-02-12 15:29:16 +03:00
Alex Vanin
357aa98aa2
Merge pull request #12 from nspcc-dev/fix/readme-sign-rfc6979-size
doc: Fix RFC6979 signature size in readme file
2020-03-02 13:50:43 +03:00
Alex Vanin
ea3b6d784b
Merge pull request #11 from nspcc-dev/fix/31-bytes-r-s
Add leading zeros if `r` or `s` has less than 32 bytes
2020-03-02 13:46:38 +03:00
alexvanin
a508496829 doc: Fix RFC6979 signature size in readme file 2020-03-02 13:38:38 +03:00
alexvanin
c1e43f8727 rfc6979: Add tests for short r and s coordinates 2020-03-01 16:57:24 +03:00
alexvanin
1461d7a248 rfc6979: Add leading zeros if r or s has less than 32 bytes
SignECDSA function returns two coordinates on elliptic curve.
Catenation of these coordinates is a 64 byte signature. If
one of these coordinates have less than 32 significant bytes, then
it should have leading zeros.
2020-03-01 16:50:38 +03:00
Evgeniy Kulikov
5ba9a8ffc6
Merge pull request #10 from nspcc-dev/update-rfc6979-library
Update RFC6979 to new release
2020-01-16 10:12:24 +03:00
Evgeniy Kulikov
4a69978816
Update RFC6979 to new release 2020-01-16 10:10:33 +03:00
Alex Vanin
2e7d56853b
Merge pull request #9 from nspcc-dev/create_metod_for_loading_private_keys
Add method to load PrivateKey
2019-11-21 17:37:21 +03:00
Evgeniy Kulikov
9f21fbbfd5
docs: add doc comment for LoadPrivateKey 2019-11-21 17:32:08 +03:00
Evgeniy Kulikov
f707f6449c
docs: describe LoadPrivateKey in readme 2019-11-21 17:29:34 +03:00
Evgeniy Kulikov
d059767e79
Add method to load PrivateKey
- from hex string
- from wif format
- from file path
2019-11-21 17:24:36 +03:00
Evgeniy Kulikov
5a95565a67
Merge pull request #8 from nspcc-dev/fix/compress-31-byte-x-point
Fix point encoding for short X coordinate
2019-11-18 13:36:21 +03:00
alexvanin
f5ad619450 Fix point encoding for short X coordinate
Public keys can have X coordinate value shorter than 32 byte.
In this case `encodePoint()` should return 32 byte value with
leading zeros.

This commit also adds unit test for public key with 31 byte
X coordinate value.
2019-11-17 21:08:58 +03:00
Evgeniy Kulikov
5bcaeeca4e
Merge pull request #7 from nspcc-dev/NEOFS_CRYPTO-4_Use_sha512_instead_of_sha256
Use SHA512 instead of SHA256
2019-11-12 16:42:33 +03:00
Evgeniy Kulikov
21d0864dae
Merge pull request #6 from nspcc-dev/NEOFS_CRYPTO-4_Change_func_Verify_signature
- Before `func Verify*(pub *ecdsa.PublicKey, sig, msg []byte) error`
- After `func Verify*(pub *ecdsa.PublicKey, msg, sig []byte) error`
- Update tests and replace `hash` with `sign` for signatures

Fix issue #5
2019-11-12 16:41:17 +03:00
Evgeniy Kulikov
943bb90aec
Use SHA512 instead of SHA256
Fix issue #4
2019-11-12 16:00:27 +03:00
Evgeniy Kulikov
fc6fd40f5e
Change func Verify signature
- Before `func Verify*(pub *ecdsa.PublicKey, sig, msg []byte) error`
- After `func Verify*(pub *ecdsa.PublicKey, msg, sig []byte) error`
- Update tests and replace `hash` with `sign` for signatures

Fix issue #5
2019-11-12 15:52:13 +03:00
Evgeniy Kulikov
bd754c2f99
Merge pull request #3 from nspcc-dev/fix-naming
Use consistent parameter names for Sign and Verify functions
2019-11-12 15:28:54 +03:00
alexvanin
8fa65a0afc Use consistent parameter names for Sign and Verify functions
It may be misleading when verify function takes signature as a hash
parameter. This commit suggested to use rfc6979 original naming
for the parameters:
- `msg` as the message to sign,
- `sig` as the signature of message.
All hashing operations are encapsulated inside of the Sign
and Verify functions.

Also there are comment fixes and re-usage of `hashBytes()` in rfc6979.
2019-11-12 14:52:23 +03:00
Evgeniy Kulikov
40d65daa2e
Merge pull request #1 from nspcc-dev/use_stdlib_formula_for_decompress_point
Refactor decompress Y point
2019-10-24 12:56:25 +03:00
Evgeniy Kulikov
e60428333c
Refactor decompress Y point 2019-10-23 14:05:04 +03:00
Evgeniy Kulikov
c21ef9ef81
initial 2019-10-22 17:40:05 +03:00