Struct sp_consensus_vrf::schnorrkel::PublicKey [−][src]
A Ristretto Schnorr public key.
Internally, these are represented as a RistrettoPoint
, meaning
an Edwards point with a static guarantee to be 2-torsion free.
At present, we decompress PublicKey
s into this representation
during deserialization, which improves error handling, but costs
a compression during signing and verifiaction.
Implementations
impl PublicKey
[src]
pub fn as_compressed(&self) -> &CompressedRistretto
[src]
Access the compressed Ristretto form
pub fn into_compressed(self) -> CompressedRistretto
[src]
Extract the compressed Ristretto form
pub fn as_point(&self) -> &RistrettoPoint
[src]
Access the point form
pub fn into_point(self) -> RistrettoPoint
[src]
Extract the point form
pub fn from_compressed(
compressed: CompressedRistretto
) -> Result<PublicKey, SignatureError>
[src]
compressed: CompressedRistretto
) -> Result<PublicKey, SignatureError>
Decompress into the PublicKey
format that also retains the
compressed form.
pub fn from_point(point: RistrettoPoint) -> PublicKey
[src]
Compress into the PublicKey
format that also retains the
uncompressed form.
pub fn to_bytes(&self) -> [u8; 32]
[src]
Convert this public key to a byte array.
Example
use schnorrkel::{SecretKey, PublicKey, PUBLIC_KEY_LENGTH, SignatureError}; let public_key: PublicKey = SecretKey::generate().to_public(); let public_key_bytes = public_key.to_bytes(); let public_key_again: PublicKey = PublicKey::from_bytes(&public_key_bytes[..]).unwrap(); assert_eq!(public_key_bytes, public_key_again.to_bytes());
pub fn from_bytes(bytes: &[u8]) -> Result<PublicKey, SignatureError>
[src]
Construct a PublicKey
from a slice of bytes.
Example
use schnorrkel::{PublicKey, PUBLIC_KEY_LENGTH, SignatureError}; let public_key_bytes: [u8; PUBLIC_KEY_LENGTH] = [ 208, 120, 140, 129, 177, 179, 237, 159, 252, 160, 028, 013, 206, 005, 211, 241, 192, 218, 001, 097, 130, 241, 020, 169, 119, 046, 246, 029, 079, 080, 077, 084]; let public_key = PublicKey::from_bytes(&public_key_bytes).unwrap(); assert_eq!(public_key.to_bytes(), public_key_bytes);
Returns
A Result
whose okay value is an EdDSA PublicKey
or whose error value
is an SignatureError
describing the error that occurred.
impl PublicKey
[src]
pub fn verify<T>(
&self,
t: T,
signature: &Signature
) -> Result<(), SignatureError> where
T: SigningTranscript,
[src]
&self,
t: T,
signature: &Signature
) -> Result<(), SignatureError> where
T: SigningTranscript,
Verify a signature by this public key on a transcript.
Requires a SigningTranscript
, normally created from a
SigningContext
and a message, as well as the signature
to be verified.
pub fn verify_simple(
&self,
ctx: &[u8],
msg: &[u8],
signature: &Signature
) -> Result<(), SignatureError>
[src]
&self,
ctx: &[u8],
msg: &[u8],
signature: &Signature
) -> Result<(), SignatureError>
Verify a signature by this public key on a message.
pub fn verify_simple_preaudit_deprecated(
&self,
ctx: &'static [u8],
msg: &[u8],
sig: &[u8]
) -> Result<(), SignatureError>
[src]
&self,
ctx: &'static [u8],
msg: &[u8],
sig: &[u8]
) -> Result<(), SignatureError>
A temporary verification routine for use in transitioning substrate testnets only.
impl PublicKey
[src]
pub fn vrf_hash<T>(&self, t: T) -> RistrettoBoth where
T: VRFSigningTranscript,
[src]
T: VRFSigningTranscript,
Create a non-malleable VRF input point by hashing a transcript to a point.
pub fn vrf_attach_hash<T>(
&self,
output: VRFOutput,
t: T
) -> Result<VRFInOut, SignatureError> where
T: VRFSigningTranscript,
[src]
&self,
output: VRFOutput,
t: T
) -> Result<VRFInOut, SignatureError> where
T: VRFSigningTranscript,
Pair a non-malleable VRF output with the hash of the given transcript.
impl PublicKey
[src]
pub fn vrfs_merge<B>(&self, ps: &[B], vartime: bool) -> VRFInOut where
B: Borrow<VRFInOut>,
[src]
B: Borrow<VRFInOut>,
Merge VRF input and output pairs from the same signer, using variable time arithmetic
You should use vartime=true
when verifying VRF proofs batched
by the singer. You could usually use vartime=true
even when
producing proofs, provided the set being signed is not secret.
There is sadly no constant time 128 bit multiplication in dalek,
making vartime=false
somewhat slower than necessary. It should
only impact signers in niche scenarios however, so the slower
variant should normally be unnecessary.
Panics if given an empty points list.
TODO: Add constant time 128 bit batched multiplication to dalek.
TODO: Is rand_chacha’s gen::<u128>()
standardizable enough to
prefer it over merlin for the output?
impl PublicKey
[src]
pub fn dleq_verify<T>(
&self,
t: T,
p: &VRFInOut,
proof: &VRFProof,
kusama: bool
) -> Result<VRFProofBatchable, SignatureError> where
T: SigningTranscript,
[src]
&self,
t: T,
p: &VRFInOut,
proof: &VRFProof,
kusama: bool
) -> Result<VRFProofBatchable, SignatureError> where
T: SigningTranscript,
Verify DLEQ proof that p.output = s * p.input
where self
s
times the basepoint.
We return an enlarged VRFProofBatchable
instead of just true,
so that verifiers can forward batchable proofs.
In principle, one might provide “blindly verifiable” VRFs that
avoid requiring self
here, but naively such constructions
risk the same flaws as DLEQ based blind signatures, and this
version exploits the slightly faster basepoint arithmetic.
pub fn vrf_verify<T>(
&self,
t: T,
out: &VRFOutput,
proof: &VRFProof
) -> Result<(VRFInOut, VRFProofBatchable), SignatureError> where
T: VRFSigningTranscript,
[src]
&self,
t: T,
out: &VRFOutput,
proof: &VRFProof
) -> Result<(VRFInOut, VRFProofBatchable), SignatureError> where
T: VRFSigningTranscript,
Verify VRF proof for one single input transcript and corresponding output.
pub fn vrf_verify_extra<T, E>(
&self,
t: T,
out: &VRFOutput,
proof: &VRFProof,
extra: E
) -> Result<(VRFInOut, VRFProofBatchable), SignatureError> where
T: VRFSigningTranscript,
E: SigningTranscript,
[src]
&self,
t: T,
out: &VRFOutput,
proof: &VRFProof,
extra: E
) -> Result<(VRFInOut, VRFProofBatchable), SignatureError> where
T: VRFSigningTranscript,
E: SigningTranscript,
Verify VRF proof for one single input transcript and corresponding output.
pub fn vrfs_verify<T, I, O>(
&self,
transcripts: I,
outs: &[O],
proof: &VRFProof
) -> Result<(Box<[VRFInOut], Global>, VRFProofBatchable), SignatureError> where
T: VRFSigningTranscript,
I: IntoIterator<Item = T>,
O: Borrow<VRFOutput>,
[src]
&self,
transcripts: I,
outs: &[O],
proof: &VRFProof
) -> Result<(Box<[VRFInOut], Global>, VRFProofBatchable), SignatureError> where
T: VRFSigningTranscript,
I: IntoIterator<Item = T>,
O: Borrow<VRFOutput>,
Verify a common VRF short proof for several input transcripts and corresponding outputs.
pub fn vrfs_verify_extra<T, E, I, O>(
&self,
transcripts: I,
outs: &[O],
proof: &VRFProof,
extra: E
) -> Result<(Box<[VRFInOut], Global>, VRFProofBatchable), SignatureError> where
T: VRFSigningTranscript,
E: SigningTranscript,
I: IntoIterator<Item = T>,
O: Borrow<VRFOutput>,
[src]
&self,
transcripts: I,
outs: &[O],
proof: &VRFProof,
extra: E
) -> Result<(Box<[VRFInOut], Global>, VRFProofBatchable), SignatureError> where
T: VRFSigningTranscript,
E: SigningTranscript,
I: IntoIterator<Item = T>,
O: Borrow<VRFOutput>,
Verify a common VRF short proof for several input transcripts and corresponding outputs.
impl PublicKey
[src]
pub fn accept_ecqv_cert<T>(
&self,
t: T,
seed_secret_key: &SecretKey,
cert_secret: ECQVCertSecret
) -> Result<(ECQVCertPublic, SecretKey), SignatureError> where
T: SigningTranscript,
[src]
&self,
t: T,
seed_secret_key: &SecretKey,
cert_secret: ECQVCertSecret
) -> Result<(ECQVCertPublic, SecretKey), SignatureError> where
T: SigningTranscript,
Accept an ECQV implicit certificate
We request an ECQV implicit certificate by first creating an
ephemeral Keypair
and sending the public portion to the issuer
as seed_public_key
. An issuer issues the certificat by replying
with the ECQVCertSecret
created by issue_ecqv_cert
.
Aside from the issuer PublicKey
supplied as self
, you provide
(1) a SigningTranscript
called t
that incorporates both the context
and the certificate requester’s identity,
(2) the seed_secret_key
corresponding to the seed_public_key
they sent to the issuer by the certificate recipient in their
certificate request, and
(3) the ECQVCertSecret
send by the issuer to the certificate
requester.
We return both your certificate’s new SecretKey
as well as
an ECQVCertPublic
from which third parties may derive
corresponding public key from h
and the issuer’s public key.
impl PublicKey
[src]
pub fn open_ecqv_cert<T>(
&self,
t: T,
cert_public: &ECQVCertPublic
) -> Result<PublicKey, SignatureError> where
T: SigningTranscript,
[src]
&self,
t: T,
cert_public: &ECQVCertPublic
) -> Result<PublicKey, SignatureError> where
T: SigningTranscript,
Trait Implementations
impl AsRef<[u8]> for PublicKey
[src]
impl Clone for PublicKey
[src]
impl Copy for PublicKey
[src]
impl Debug for PublicKey
[src]
impl Default for PublicKey
[src]
impl Derivation for PublicKey
[src]
pub fn derived_key<T>(&self, t: T, cc: ChainCode) -> (PublicKey, ChainCode) where
T: SigningTranscript,
[src]
T: SigningTranscript,
pub fn derived_key_simple<B>(&self, cc: ChainCode, i: B) -> (Self, ChainCode) where
B: AsRef<[u8]>,
[src]
B: AsRef<[u8]>,
pub fn derived_key_simple_rng<B, R>(
&self,
cc: ChainCode,
i: B,
rng: R
) -> (Self, ChainCode) where
R: RngCore + CryptoRng,
B: AsRef<[u8]>,
[src]
&self,
cc: ChainCode,
i: B,
rng: R
) -> (Self, ChainCode) where
R: RngCore + CryptoRng,
B: AsRef<[u8]>,
impl<'d> Deserialize<'d> for PublicKey
[src]
pub fn deserialize<D>(
deserializer: D
) -> Result<PublicKey, <D as Deserializer<'d>>::Error> where
D: Deserializer<'d>,
[src]
deserializer: D
) -> Result<PublicKey, <D as Deserializer<'d>>::Error> where
D: Deserializer<'d>,
impl Eq for PublicKey
[src]
impl From<SecretKey> for PublicKey
[src]
impl Hash for PublicKey
[src]
pub fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for PublicKey
[src]
pub fn cmp(&self, other: &PublicKey) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<PublicKey> for PublicKey
[src]
impl PartialOrd<PublicKey> for PublicKey
[src]
pub fn partial_cmp(&self, other: &PublicKey) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for PublicKey
[src]
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
impl StructuralEq for PublicKey
[src]
impl StructuralPartialEq for PublicKey
[src]
Auto Trait Implementations
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnwindSafe for PublicKey
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, U> AsByteSlice<T> for U where
T: ToByteSlice,
U: AsRef<[T]> + ?Sized,
[src]
T: ToByteSlice,
U: AsRef<[T]> + ?Sized,
pub fn as_byte_slice(&self) -> &[u8]
[src]
impl<U> AsSliceOf for U where
U: AsRef<[u8]> + ?Sized,
[src]
U: AsRef<[u8]> + ?Sized,
pub fn as_slice_of<T>(&self) -> Result<&[T], Error> where
T: FromByteSlice,
[src]
T: FromByteSlice,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CallHasher for T where
T: Hash,
[src]
T: Hash,
impl<T> CheckedConversion for T
[src]
pub fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
[src]
Self: TryFrom<T>,
pub fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
[src]
Self: TryInto<T>,
impl<T> Clear for T where
T: Default + Eq + PartialEq<T>,
[src]
T: Default + Eq + PartialEq<T>,
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
pub fn __clone_box(&self, Private) -> *mut ()
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, Outer> IsWrappedBy<Outer> for T where
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
[src]
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
pub fn from_ref(outer: &Outer) -> &T
[src]
Get a reference to the inner from the outer.
pub fn from_mut(outer: &mut Outer) -> &mut T
[src]
Get a mutable reference to the inner from the outer.
impl<T> MaybeDebug for T where
T: Debug,
[src]
T: Debug,
impl<T> MaybeDebug for T where
T: Debug,
[src]
T: Debug,
impl<T> MaybeHash for T where
T: Hash,
[src]
T: Hash,
impl<T> MaybeHash for T where
T: Hash,
[src]
T: Hash,
impl<T> MaybeRefUnwindSafe for T where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> MaybeSerialize for T where
T: Serialize,
[src]
T: Serialize,
impl<T> MaybeSerializeDeserialize for T where
T: DeserializeOwned + Serialize,
[src]
T: DeserializeOwned + Serialize,
impl<T> Member for T where
T: 'static + Send + Sync + Debug + Eq + PartialEq<T> + Clone,
[src]
T: 'static + Send + Sync + Debug + Eq + PartialEq<T> + Clone,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> SaturatedConversion for T
[src]
pub fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
[src]
Self: UniqueSaturatedFrom<T>,
pub fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
[src]
Self: UniqueSaturatedInto<T>,
impl<T> ToHex for T where
T: AsRef<[u8]>,
[src]
T: AsRef<[u8]>,
pub fn encode_hex<U>(&self) -> U where
U: FromIterator<char>,
[src]
U: FromIterator<char>,
pub fn encode_hex_upper<U>(&self) -> U where
U: FromIterator<char>,
[src]
U: FromIterator<char>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
[src]
T: UncheckedFrom<S>,
pub fn unchecked_into(self) -> T
[src]
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
[src]
T: Bounded,
S: TryInto<T>,
pub fn unique_saturated_into(self) -> T
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,