structstd.crypto.25519.ed25519.Ed25519.key_blinding.BlindPublicKey[src]

A blind public key.

Fields

key: PublicKey

Public key equivalent, that can used for signature verification.

Functions

Functionunblind[src]

pub fn unblind(blind_public_key: BlindPublicKey, blind_seed: [blind_seed_length]u8, ctx: []const u8) (IdentityElementError || NonCanonicalError || EncodingError || WeakPublicKeyError)!PublicKey

Recover a public key from a blind version of it.

Parameters

blind_public_key: BlindPublicKey
blind_seed: [blind_seed_length]u8
ctx: []const u8

Source Code

Source code
pub fn unblind(blind_public_key: BlindPublicKey, blind_seed: [blind_seed_length]u8, ctx: []const u8) (IdentityElementError || NonCanonicalError || EncodingError || WeakPublicKeyError)!PublicKey {
    const blind_h = blindCtx(blind_seed, ctx);
    const inv_blind_factor = Scalar.fromBytes(blind_h[0..32].*).invert().toBytes();
    const pk_p = try (try Curve.fromBytes(blind_public_key.key.bytes)).mul(inv_blind_factor);
    return PublicKey.fromBytes(pk_p.toBytes());
}

Source Code

Source code
pub const BlindPublicKey = struct {
    /// Public key equivalent, that can used for signature verification.
    key: PublicKey,

    /// Recover a public key from a blind version of it.
    pub fn unblind(blind_public_key: BlindPublicKey, blind_seed: [blind_seed_length]u8, ctx: []const u8) (IdentityElementError || NonCanonicalError || EncodingError || WeakPublicKeyError)!PublicKey {
        const blind_h = blindCtx(blind_seed, ctx);
        const inv_blind_factor = Scalar.fromBytes(blind_h[0..32].*).invert().toBytes();
        const pk_p = try (try Curve.fromBytes(blind_public_key.key.bytes)).mul(inv_blind_factor);
        return PublicKey.fromBytes(pk_p.toBytes());
    }
}