def validate_pwhash(_self, params):
    """
    Validate password hash using YubiHSM.
    """
    pwhash, nonce, aead, key_handle = get_pwhash_bits(params)
    d_aead = aead.decode('hex')
    plaintext_len = len(d_aead) - pyhsm.defines.YSM_AEAD_MAC_SIZE
    pw = pwhash.ljust(plaintext_len, chr(0x0))
    if hsm.validate_aead(nonce.decode('hex'), key_handle, d_aead, pw):
        return "OK pwhash validated"
    return "ERR Could not validate pwhash"
Validate password hash using YubiHSM.