/// Verifies a public key's proof of possession (PoP).
///
/// As part of the PoP verification, it is also verified that the
/// public key is a point on the curve and in the right subgroup.
///
/// # Errors
/// * `CryptoError::MalformedPop` if `pop_bytes` cannot be parsed as a valid G1
///   point.
/// * `CryptoError::MalformedPublicKey` if `public_key_bytes` cannot be parsed
///   as a valid G2 point.
/// * `CryptoError::PopVerification` if the given PoP fails to verify.
Verifies a public key's proof of possession (PoP).
As part of the PoP verification, it is also verified that the
public key is a point on the curve and in the right subgroup.
Verifies a public key ' s proof of possession ( PoP ) . As part of the PoP verification it is also verified that the public key is a point on the curve and in the right subgroup .
pub fn verify_pop(
    pop_bytes: PopBytes,
    public_key_bytes: PublicKeyBytes,
) -> Result<(), CryptoError> {
    let pop = Pop::try_from(pop_bytes)?;
    let public_key = PublicKey::try_from(public_key_bytes)?;
    if crypto::verify_pop(pop, public_key) {
        Ok(())
    } else {
        Err(CryptoError::PopVerification {
            algorithm: AlgorithmId::MultiBls12_381,
            public_key_bytes: public_key_bytes.0.to_vec(),
            pop_bytes: pop_bytes.0.to_vec(),
            internal_error: "PoP verification failed".to_string(),
        })
    }
}
pub fn verify_pop ( pop_bytes : PopBytes , public_key_bytes : PublicKeyBytes , ) -> Result < ( ) , CryptoError > { let pop = Pop :: try_from ( pop_bytes ) ? ; let public_key = PublicKey :: try_from ( public_key_bytes ) ? ; if crypto :: verify_pop ( pop , public_key ) { Ok ( ( ) ) } else { Err ( CryptoError :: PopVerification { algorithm : AlgorithmId :: MultiBls12_381 , public_key_bytes : public_key_bytes . 0 . to_vec ( ) , pop_bytes : pop_bytes . 0 . to_vec ( ) , internal_error : " " . to_string ( ) , } ) } }
Verifies a public key's proof of possession (PoP).
Verifies a public key ' s proof of possession ( PoP ) .
pop_bytes
PopBytes
public_key_bytes
PublicKeyBytes
errors
`CryptoError::MalformedPop` if `pop_bytes` cannot be parsed as a valid G1
point.
`CryptoError::MalformedPublicKey` if `public_key_bytes` cannot be parsed
as a valid G2 point.
`CryptoError::PopVerification` if the given PoP fails to verify.
` CryptoError :: MalformedPop ` if ` pop_bytes ` cannot be parsed as a valid G1 point . ` CryptoError :: MalformedPublicKey ` if ` public_key_bytes ` cannot be parsed as a valid G2 point . ` CryptoError :: PopVerification ` if the given PoP fails to verify .