-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add regexp for better error handling in addauthor (orcide, inst, email) #238
Changes from all commits
16e27ea
f4ee956
922e2ad
1ce8c29
22e6800
09ecd77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
\def\fileversion{0.66} | ||
\def\filedate{2024/04/09} | ||
\def\fileversion{0.67} | ||
\def\filedate{2024/04/16} | ||
|
||
\NeedsTeXFormat{LaTeX2e}[1995/12/01] | ||
\typeout{^^J *** LaTeX class for IACR Communications in Cryptology v\fileversion\space ***^^J} | ||
|
@@ -558,6 +558,44 @@ | |
\ClassError{iacrcc}{Do not use the \string\author\space macro: use the \string\addauthor\space macro instead}{}% | ||
} | ||
|
||
\ExplSyntaxOn | ||
\prg_new_conditional:Npnn \iacr_check_orcid:n #1 { T, F, TF } | ||
{ | ||
\cs_generate_variant:Nn \regex_match:nnTF {nV} | ||
% An Orcid consists of: | ||
% 4 digits, "-", 4 digits, "-", 4 digits, "-", 3 digits, 1 digit or "x" or "X" | ||
\regex_match:nnTF {^\d{4}-\d{4}-\d{4}-\d{3}[Xx\d]$} { #1 } | ||
{ \prg_return_true: } | ||
{ \prg_return_false: } | ||
} | ||
\cs_new_eq:NN \IfValidOrcid \iacr_check_orcid:nTF | ||
|
||
\prg_new_conditional:Npnn \iacr_check_inst:n #1 { T, F, TF } | ||
{ | ||
\cs_generate_variant:Nn \regex_match:nnTF {nV} | ||
% An institute index should be a number, multiple institutes are separated by a comma: | ||
\regex_match:nnTF {^[,\d]+$} { #1 } | ||
{ \prg_return_true: } | ||
{ \prg_return_false: } | ||
} | ||
\cs_new_eq:NN \IfValidInst \iacr_check_inst:nTF | ||
|
||
\prg_new_conditional:Npnn \iacr_check_email:n #1 { T, F, TF } | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not convinced that we should check email addresses. Some people may like to put firstname dot lastname to obfuscate it, and I don't think we should interfere with that. The only purpose of the email address in the paper is to allow readers to contact at least one author, but we don't use it for any other registration (there is a separate validated email address from hotcrp when the corresponding author uploads their final version). It's also really complicated to recognize 100% of email addresses with a regex. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The point is not to check / validate the email address. We want to make sure this looks somewhat like a valid string used for an email address and not that a comma has been forgotten in the \addauthor macro. |
||
\cs_generate_variant:Nn \regex_match:nnTF {nV} | ||
% The format of e-mail addresses is complicated (see: https://en.wikipedia.org/wiki/Email_address) | ||
% We lazy match all characters until the '@' (the local part) and then we only allow dot-seperated | ||
% uppercase and lowercase Latin letters A to Z and a to z; | ||
% Digits 0 to 9; | ||
% Hyphen -, and brackets [] | ||
% for the domain part | ||
\regex_match:nnTF {.*?@[a-zA-Z0-9\.\-\[\]]+$} { #1 } | ||
{ \prg_return_true: } | ||
{ \prg_return_false: } | ||
} | ||
\cs_new_eq:NN \IfValidEmail \iacr_check_email:nTF | ||
\ExplSyntaxOff | ||
|
||
\newcommand\addauthor[2][]{% | ||
\MathAllowedInCheckStringfalse | ||
\checkstring{#2}{author names should not contain macros or math}% | ||
|
@@ -591,6 +629,25 @@ | |
\pgfkeysgetvalue{/IACR-author/entities/inst}{\@IACR@author@inst}% | ||
\pgfkeysgetvalue{/IACR-author/entities/email}{\@IACR@author@email}% | ||
\expandafter\let\csname IACR@author@footnote\alphalph{\theIACR@author@cnt} \endcsname\@IACR@author@footnote% Copy the pgf key | ||
% Check the format of the Orcid | ||
\if\relax\expandafter\detokenize\expandafter{\@IACR@author@orcid}\relax\else | ||
\expandafter\IfValidOrcid\expandafter{\@IACR@author@orcid}{}{% | ||
\ClassErr{The provided ORCID in \string\addauthor\space does not look valid: \@IACR@author@orcid. Did you forget a comma?}% | ||
}{}% | ||
\fi | ||
% Check the format of the inst | ||
\if\relax\expandafter\detokenize\expandafter{\@IACR@author@inst}\relax\else | ||
\expandafter\IfValidInst\expandafter{\@IACR@author@inst}{}{% | ||
\ClassErr{The provided inst in \string\addauthor\space does not look valid: \@IACR@author@inst. Did you forget a comma?}% | ||
}{}% | ||
\fi | ||
% Check the format of the email | ||
\if\relax\expandafter\detokenize\expandafter{\@IACR@author@email}\relax\else | ||
\expandafter\IfValidEmail\expandafter{\@IACR@author@email}{}{% | ||
\ClassErr{The provided email in \string\addauthor\space does not look valid: \@IACR@author@email. Did you forget a comma?}% | ||
}{}% | ||
\fi | ||
% | ||
\@writemeta{\IACRSS name: #2}% | ||
\if\relax\expandafter\detokenize\expandafter{\@IACR@author@surname}\relax\else | ||
% If a surname is provided does some basic sanity checking on the string | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../iacrcc.cls |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
%%%% 1. DOCUMENTCLASS %%%% | ||
\documentclass[version=final]{iacrcc} | ||
%%%% NOTES: | ||
% - Add "spthm" for LNCS-like theorems | ||
|
||
\errorcontextlines=5 | ||
\newcommand\niceguy{Fester Bestertester} | ||
%%%% 2. PACKAGES %%%% | ||
\usepackage{lipsum} % Example package -- can be removed | ||
\usepackage{amsmath} | ||
\usepackage[TU]{fontenc} | ||
\usepackage[T1]{fontenc} | ||
%%%% 3. AUTHOR, INSTITUTE %%%% | ||
|
||
\license{CC-by} | ||
|
||
% NOTE: There are two affiliations, referred to by 1,2 | ||
\addauthor[orcid=0000-0003-1010-8157 | ||
inst={1,2}, | ||
footnote={Work done while working for XYZ.}]{Alice Accomplished} | ||
% NOTE: Only one affiliation for this author. | ||
\addauthor[inst={1}, | ||
footnote={Thanks to my mom!}, | ||
email={[email protected]}]{Bob Badenuff} | ||
\addauthor[inst={3,2,1}]{Tancr{\`e}de Lepoint} | ||
\addaffiliation[ror=02t274463,country={United States}]{University of California, Santa Barbara} | ||
\addaffiliation[country={Elbonia}]{University of Antartica} | ||
\addaffiliation[country={Turkey}]{Bo{\u g}azi{\c c}i University} | ||
|
||
\genericfootnote{This is the full-version of our previous work.} | ||
|
||
%%%% 4. TITLE %%%% | ||
% Note that \thanks and \footnote are forbidden in \title. Please use | ||
% \genericfootnote. | ||
\title[running={Thoughts on binary functions}, | ||
plaintext={Thoughts about "binary" functions and \$\ on $GF(p)$ by Fester Bestertester at 30°C}]{% | ||
Thoughts about "binary" functions and \$\ on $GF(p)$ by \niceguy\ at 30°C} | ||
\begin{document} | ||
|
||
\maketitle | ||
|
||
%%%% 5. ABSTRACT %%%% | ||
\begin{abstract} | ||
In this paper we prove that the One-Time-Pad has perfect security, unless you use | ||
double encryption with {$\mathsf{SingleKey}$}. | ||
|
||
\lipsum[8] | ||
\end{abstract} | ||
\begin{textabstract} | ||
In this paper we prove that the One-Time-Pad has perfect security, unless you use | ||
double encryption with a single key. | ||
\end{textabstract} | ||
|
||
|
||
%%%% 6. PAPER CONTENT %%%% | ||
\section{Introduction} | ||
|
||
Widely used primitives like the AES~\cite{AES} do not have perfect | ||
security, and can be analysed with linear | ||
cryptanalysis~\cite{EC:Matsui93}, differential | ||
cryptanalysis~\cite{JC:BihSha91}, or differential power | ||
analysis~\cite{C:KocJafJun99}. We show that the One-Time-Pad is | ||
unconditionally secure in \autoref{sec:main}. Let's not forget | ||
the work by John~\cite{vonNeumann}. | ||
|
||
Note that we can tolerate ampersands~\cite{Dalheimer02} and \TeX | ||
character codes~\cite{Bohme10} and math in | ||
title~\cite{ACISP:MurPla19,ACISP:LYLF19,ACISP:WeiSteSha03,CCS:BHKNRS19,ACNS:DurHugVau20}. | ||
|
||
\lipsum[9] | ||
|
||
\section{Main Result}\label{sec:main} | ||
|
||
\lipsum | ||
|
||
\section{Section heading with math in it $a=b$} | ||
\lipsum | ||
|
||
This\footnote{is a footnote}. | ||
|
||
This is the unicode degree symbol: 30° | ||
|
||
\bibliography{test1} | ||
|
||
\end{document} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the numbers are supposed to start at 1 (not 0), but a later check will notice this when the paper is compiled. I don't think we need to check it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly, same point as above. This is just a basic sanity check not a comprehensive validation.