Skip to content

Function to look up Object IDs - #20346

Open
StephenWall wants to merge 8 commits into
php:masterfrom
StephenWall:oid-lookup
Open

Function to look up Object IDs#20346
StephenWall wants to merge 8 commits into
php:masterfrom
StephenWall:oid-lookup

Conversation

@StephenWall

Copy link
Copy Markdown
Contributor

Add a function to lookup and return an OID, short name, and long name, given a string containing any one of those, for all OIDs known to OpenSSL.

Examples:

php > var_export(openssl_oid_lookup("CN"));
array (
  'oid' => '2.5.4.3',
  'lname' => 'commonName',
  'sname' => 'CN',
)
php > var_export(openssl_oid_lookup("unstructuredName"));
array (
  'oid' => '1.2.840.113549.1.9.2',
  'lname' => 'unstructuredName',
)
php > var_export(openssl_oid_lookup("1.2.3.4.5"));
array (
  'oid' => '1.2.3.4.5',
)
php > var_export(openssl_oid_lookup("junk"));
false

@bukka bukka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is useful. I will leave open for a while and if no one objects, I will merge it.

Comment thread ext/openssl/openssl.c Outdated

@bukka bukka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I did a bit more checking and this needs some changes.

Comment thread ext/openssl/tests/openssl_oid_lookup_basic.phpt Outdated
Comment thread ext/openssl/openssl.c Outdated
Comment thread ext/openssl/openssl.c Outdated
Comment thread ext/openssl/openssl.c Outdated
Comment thread ext/openssl/openssl.c Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants