Skip to content

scion-pki: support additional extended key usage#4899

Open
lukedirtwalker wants to merge 4 commits into
scionproto:masterfrom
lukedirtwalker:opensource-additional-eku
Open

scion-pki: support additional extended key usage#4899
lukedirtwalker wants to merge 4 commits into
scionproto:masterfrom
lukedirtwalker:opensource-additional-eku

Conversation

@lukedirtwalker
Copy link
Copy Markdown
Collaborator

Add the ability to specify additional extended key usage (EKU) in the certificate creation process. This applies to scion-pki certificate create and scion-pki certificate sign commands.

When setting the --eku-any flag is set, the ExtKeyUsageAny is set on the certificate or CSR. Furthermore, the --eku flag allows the user to provide a comma-separated list of ASN.1 OIDs for additional EKUs that are unknown to scion-pki.

Add the ability to specify additional extended key usage (EKU) in the
certificate creation process. This applies to `scion-pki certificate create`
and `scion-pki certificate sign` commands.

When setting the `--eku-any` flag is set, the ExtKeyUsageAny is set on
the certificate or CSR. Furthermore, the `--eku` flag allows the user
to provide a comma-separated list of ASN.1 OIDs for additional EKUs
that are unknown to scion-pki.
@lukedirtwalker lukedirtwalker requested a review from oncilla as a code owner March 9, 2026 07:40
@@ -0,0 +1,27 @@
// Copyright 2025 Anapaya Systems
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2026, right?

Comment thread scion-pki/certs/create.go
}
}

func parseOID(s string) (asn1.ObjectIdentifier, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not an expert on this topic, but it looks like parseOID is too permissive according to RFC 4512 - 1.4

Seems to violate:

  • minimum two arcs
  • no leading zeros
  • no negative arcs
func TestParseOIDRejectsInvalidRFC4512Numericoids(t *testing.T) {
	// https://datatracker.ietf.org/doc/html/rfc4512#section-1.4
	testCases := map[string]string{
		// "numericoid = number 1*( DOT number )"
		// A numericoid must contain at least two arcs.
		"single arc": "1",

		// "number = DIGIT / ( LDIGIT 1*DIGIT )"
		// A numericoid arc is a decimal number, so '-' is not allowed.
		"negative arc": "1.-2",

		// "number = DIGIT / ( LDIGIT 1*DIGIT )"
		// Multi-digit arcs must start with LDIGIT (1-9), not 0.
		"leading zero in first arc": "01.2",

		// "number = DIGIT / ( LDIGIT 1*DIGIT )"
		// The same no-leading-zero rule applies to every arc.
		"leading zero in later arc": "1.02",
	}
	for name, input := range testCases {
		t.Run(name, func(t *testing.T) {
			_, err := parseOID(input)
			require.Error(t, err)
		})
	}
}

Is strict compliance not necessary in this particular context?
Please correct me if I'm wrong, but as far as I undertood the consequence would be a nonsensical OID baked in to the cert, which isn't really a security problem but a minor inconvenience?

@nicorusti
Copy link
Copy Markdown
Contributor

@lukedirtwalker is this in any way affecting the PKI draft (that we can still change)
JFYI we were discussing EKU recently in scionassociation/scion-cppki_I-D#79

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants