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
17
17
class CertificateUtilSpec extends AnyFunSpec with Matchers {
18
18
describe(" parseFidoSerNumExtension" ) {
19
19
val idFidoGenCeSernum = " 1.3.6.1.4.1.45724.1.1.2"
20
+
20
21
it(" correctly parses the id-fido-gen-ce-sernum extension." ) {
21
22
val (cert, _): (X509Certificate , _) = TestAuthenticator
22
23
.generateAttestationCertificate(
@@ -37,6 +38,16 @@ class CertificateUtilSpec extends AnyFunSpec with Matchers {
37
38
result should equal(Some (ByteArray .fromHex(" 00010203" )))
38
39
}
39
40
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
+
40
51
it(" correctly parses the serial number from a real YubiKey enterprise attestation certificate." ) {
41
52
val cert = CertificateParser .parsePem(""" -----BEGIN CERTIFICATE-----
42
53
|MIIC8zCCAdugAwIBAgIJAKr/KiUzkKrgMA0GCSqGSIb3DQEBCwUAMC8xLTArBgNV
You can’t perform that action at this time.
0 commit comments