+sub validate_yubico_otp : prototype($$) {
+ my ($userid, $realm, $value) = @_;
+
+ my $domain_cfg = cfs_read_file('domains.cfg');
+ my $realm_cfg = $domain_cfg->{ids}->{$realm};
+ die "auth domain '$realm' does not exist\n" if !$realm_cfg;
+
+ my $realm_tfa = $realm_cfg->{tfa};
+ die "no yubico otp configuration available for realm $realm\n"
+ if !$realm_tfa;
+
+ $realm_tfa = PVE::Auth::Plugin::parse_tfa_config($realm_tfa);
+ die "realm is not setup for Yubico OTP\n"
+ if !$realm_tfa || $realm_tfa->{type} ne 'yubico';
+
+ my $public_key = substr($value, 0, 12);
+
+ PVE::AccessControl::authenticate_yubico_do($value, $public_key, $realm_tfa);
+
+ return $public_key;
+}
+