Hi there,
The LGPL PHP class Yubicloud (
http://developer.sysco.ch/php/#yubicloud) is working
without any dependency! Validation protocol 2.0 is implemented, and if you already have an API key, it will be a breeze to implement it, in ... 3 lines !!!
Code:
require_once('yubicloud.class.php');
$yubicloud = new Yubicloud("my_client_id", "my_secret_key");
$result = $yubicloud->CheckOnYubiCloud($otp_to_check);
Possible returned value is one of the following:
Code:
OK The OTP is valid.
BAD_OTP The OTP is invalid format.
REPLAYED_OTP The OTP has already been seen by the service.
BAD_SIGNATURE The HMAC signature verification failed.
MISSING_PARAMETER The request lacks a parameter.
NO_SUCH_CLIENT The request id does not exist.
OPERATION_NOT_ALLOWED The request id is not allowed to verify OTPs.
BACKEND_ERROR Unexpected error in Yubico servers. Please contact them if you see this error.
NOT_ENOUGH_ANSWERS Server could not get requested number of syncs during before timeout.
REPLAYED_REQUEST Server has seen the OTP/Nonce combination before.
BAD_NONCE Answer Nonce is different from the request Nonce.
CONNECTION_ERROR Impossible to make a connection with the YubiCloud servers.
OTP_IS_DIFFERENT Answer OTP is different from request OTP.
OUT_OF_TIME_WINDOW Timestamp difference with the Yubico servers is bigger than yubicloud_max_time_window.
SERVER_TIMEOUT Timeout while waiting an answer from the server.
If you have a valid YubiKey, you can check it directly on the project page.
Comments and suggestions welcome!
If you need a Yubico OTP server side solution, have a look at the
Pure PHP YubiKey class (also without dependency).
For an OATH-HOTP support, have a look to our more complete multiOTP open source project (
http://www.multiotp.net/).
Best regards,
Andre