From RFC 5280 section 4.1.2.2 Serial Number:
4.1.2.2. Serial Number
The serial number MUST be a positive integer assigned by the CA to
each certificate. It MUST be unique for each certificate issued by a
given CA (i.e., the issuer name and serial number identify a unique
certificate). CAs MUST force the serialNumber to be a non-negative
integer.
To answer your question; since it's an integer, valid characters are 0-9
. Of course, for display purposes you can encode this integer however you want (decimal, hex, base64, etc), but in the actual certificate file it's going to be saved as ASN.1 raw bytes and other software consuming your certificate will parse that as an integer and throw errors if it's not in the right range.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…