2022-04-05 11:13:34 +00:00
|
|
|
/*
|
2022-12-29 10:46:18 +00:00
|
|
|
Package frostfscrypto collects FrostFS cryptographic primitives.
|
2022-04-05 11:13:34 +00:00
|
|
|
|
2022-12-29 10:46:18 +00:00
|
|
|
Signer type unifies entities for signing FrostFS data.
|
2022-08-24 14:17:40 +00:00
|
|
|
|
2022-04-05 11:13:34 +00:00
|
|
|
// instantiate Signer
|
|
|
|
// select data to be signed
|
|
|
|
|
|
|
|
var sig Signature
|
|
|
|
|
|
|
|
err := sig.Calculate(signer, data)
|
|
|
|
// ...
|
|
|
|
|
|
|
|
// attach signature to the request
|
|
|
|
|
|
|
|
SDK natively supports several signature schemes that are implemented
|
|
|
|
in nested packages.
|
|
|
|
|
|
|
|
PublicKey allows to verify signatures.
|
2022-08-24 14:17:40 +00:00
|
|
|
|
2022-04-05 11:13:34 +00:00
|
|
|
// get signature to be verified
|
|
|
|
// compose signed data
|
|
|
|
|
|
|
|
isValid := sig.Verify(data)
|
|
|
|
// ...
|
|
|
|
|
2022-12-29 10:46:18 +00:00
|
|
|
Signature can be also used to process FrostFS API V2 protocol messages
|
2023-03-07 11:20:03 +00:00
|
|
|
(see neo.fs.v2.refs package in https://git.frostfs.info/TrueCloudLab/frostfs-api).
|
2022-04-05 11:13:34 +00:00
|
|
|
|
|
|
|
On client side:
|
2022-08-24 14:17:40 +00:00
|
|
|
|
2023-03-07 11:20:03 +00:00
|
|
|
import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
2022-04-05 11:13:34 +00:00
|
|
|
|
|
|
|
var msg refs.Signature
|
|
|
|
sig.WriteToV2(&msg)
|
|
|
|
|
|
|
|
// send msg
|
|
|
|
|
|
|
|
On server side:
|
2022-08-24 14:17:40 +00:00
|
|
|
|
2022-04-05 11:13:34 +00:00
|
|
|
// recv msg
|
|
|
|
|
2022-12-13 14:36:35 +00:00
|
|
|
var sig frostfscrypto.Signature
|
2022-04-05 11:13:34 +00:00
|
|
|
sig.ReadFromV2(msg)
|
|
|
|
|
|
|
|
// process sig
|
|
|
|
|
|
|
|
Using package types in an application is recommended to potentially work with
|
|
|
|
different protocol versions with which these types are compatible.
|
|
|
|
*/
|
2022-12-13 14:36:35 +00:00
|
|
|
package frostfscrypto
|