1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
//!
//! SQIsign signature verification in pure Rust.
//!
//! This crate is `no_std`-compatible, heap-free, and independent of the
//! quaternion algebra stack. It contains all the arithmetic layers needed
//! for verification: field arithmetic (params, fp), elliptic curves (ec),
//! theta model (theta), precomputed constants (precomp), and the
//! verification protocol itself.
//!
//! # Verify a signature
//!
//! All verification goes through [`pk.verify(msg, &sig)`](Verifier::verify)
//! via the RustCrypto [`Verifier`] trait. It accepts any signature type:
//! [`Signature`], [`ExpandedSignature`], [`CompressedSignature`], or
//! [`AnySignature`](formats::AnySignature) (auto-detected from raw bytes).
//!
//! ```
//! use hex_literal::hex;
//! use sqisign_verify::{PublicKey, Signature, Verifier};
//!
//! # fn main() -> Result<(), sqisign_verify::Error> {
//! let pk_bytes = hex!(
//! "07CCD21425136F6E865E497D2D4D208F0054AD81372066E817480787AAF7B202"
//! "9550C89E892D618CE3230F23510BFBE68FCCDDAEA51DB1436B462ADFAF008A01"
//! "0B"
//! );
//! let sig_bytes = hex!(
//! "84228651F271B0F39F2F19F2E8718F31ED3365AC9E5CB303AFE663D0CFC11F04"
//! "55D891B0CA6C7E653F9BA2667730BB77BEFE1B1A31828404284AF8FD7BAACC01"
//! "0001D974B5CA671FF65708D8B462A5A84A1443EE9B5FED7218767C9D85CEED04"
//! "DB0A69A2F6EC3BE835B3B2624B9A0DF68837AD00BCACC27D1EC806A448402674"
//! "71D86EFF3447018ADB0A6551EE8322AB30010202"
//! );
//! let msg = hex!(
//! "D81C4D8D734FCBFBEADE3D3F8A039FAA2A2C9957E835AD55B22E75BF57BB556A"
//! "C8"
//! );
//!
//! let pk: PublicKey = PublicKey::from_bytes(&pk_bytes)?;
//! let sig: Signature = Signature::from_bytes(&sig_bytes)?;
//! pk.verify(&msg, &sig)?;
//! # Ok(())
//! # }
//! ```
//!
//! For raw bytes where the format is unknown, parse into
//! [`AnySignature`](formats::AnySignature) first:
//!
//! ```
//! use hex_literal::hex;
//! use sqisign_verify::{formats::AnySignature, PublicKey, Verifier};
//!
//! # fn main() -> Result<(), sqisign_verify::Error> {
//! # let pk_bytes = hex!(
//! # "07CCD21425136F6E865E497D2D4D208F0054AD81372066E817480787AAF7B202"
//! # "9550C89E892D618CE3230F23510BFBE68FCCDDAEA51DB1436B462ADFAF008A01"
//! # "0B"
//! # );
//! # let sig_bytes = hex!(
//! # "84228651F271B0F39F2F19F2E8718F31ED3365AC9E5CB303AFE663D0CFC11F04"
//! # "55D891B0CA6C7E653F9BA2667730BB77BEFE1B1A31828404284AF8FD7BAACC01"
//! # "0001D974B5CA671FF65708D8B462A5A84A1443EE9B5FED7218767C9D85CEED04"
//! # "DB0A69A2F6EC3BE835B3B2624B9A0DF68837AD00BCACC27D1EC806A448402674"
//! # "71D86EFF3447018ADB0A6551EE8322AB30010202"
//! # );
//! # let msg = hex!(
//! # "D81C4D8D734FCBFBEADE3D3F8A039FAA2A2C9957E835AD55B22E75BF57BB556A"
//! # "C8"
//! # );
//! let pk: PublicKey = PublicKey::from_bytes(&pk_bytes)?;
//! let sig = AnySignature::from_bytes(&sig_bytes)?;
//! pk.verify(&msg, &sig)?;
//! # Ok(())
//! # }
//! ```
pub use ;
pub use hash_to_challenge;
pub use ;
pub use ;
pub use ;
pub use LevelPrecomp;
pub use ;
/// Error type for verification failures.
extern crate std;