File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
webauthn-server-attestation/src/test/scala/com/yubico/webauthn/attestation Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import scala.jdk.OptionConverters.RichOptional
1717class CertificateUtilSpec extends AnyFunSpec with Matchers {
1818 describe(" parseFidoSerNumExtension" ) {
1919 val idFidoGenCeSernum = " 1.3.6.1.4.1.45724.1.1.2"
20+
2021 it(" correctly parses the id-fido-gen-ce-sernum extension." ) {
2122 val (cert, _): (X509Certificate , _) = TestAuthenticator
2223 .generateAttestationCertificate(
@@ -37,6 +38,16 @@ class CertificateUtilSpec extends AnyFunSpec with Matchers {
3738 result should equal(Some (ByteArray .fromHex(" 00010203" )))
3839 }
3940
41+ it(" returns empty when cert has no id-fido-gen-ce-sernum extension." ) {
42+ val (cert, _): (X509Certificate , _) =
43+ TestAuthenticator .generateAttestationCertificate(extensions = Nil )
44+ val result =
45+ CertificateUtil
46+ .parseFidoSerNumExtension(cert)
47+ .toScala
48+ result should be(None )
49+ }
50+
4051 it(" correctly parses the serial number from a real YubiKey enterprise attestation certificate." ) {
4152 val cert = CertificateParser .parsePem(""" -----BEGIN CERTIFICATE-----
4253 |MIIC8zCCAdugAwIBAgIJAKr/KiUzkKrgMA0GCSqGSIb3DQEBCwUAMC8xLTArBgNV
You can’t perform that action at this time.
0 commit comments