Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
fusiondirectory
WebAuthn
Commits
d7b27545
Commit
d7b27545
authored
4 years ago
by
Lukas Buchs
Browse files
Options
Download
Patches
Plain Diff
fixes for apple attestation format
parent
2702b14a
master
v2.0.0-beta
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.0
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+2
-1
.gitignore
Attestation/Format/Apple.php
+17
-9
Attestation/Format/Apple.php
README.md
+2
-2
README.md
with
21 additions
and
12 deletions
+21
-12
.gitignore
+
2
−
1
View file @
d7b27545
# Netbeans project
# Netbeans project
nbproject/
nbproject/
\ No newline at end of file
/index.php
This diff is collapsed.
Click to expand it.
Attestation/Format/Apple.php
+
17
−
9
View file @
d7b27545
...
@@ -98,25 +98,33 @@ class Apple extends FormatBase {
...
@@ -98,25 +98,33 @@ class Apple extends FormatBase {
throw
new
WebAuthnException
(
'invalid x5c certificate: '
.
\
openssl_error_string
(),
WebAuthnException
::
INVALID_DATA
);
throw
new
WebAuthnException
(
'invalid x5c certificate: '
.
\
openssl_error_string
(),
WebAuthnException
::
INVALID_DATA
);
}
}
// DEBUG
file_put_contents
(
'apple_'
.
time
()
.
'.pem'
,
$this
->
getCertificatePem
());
file_put_contents
(
'apple_'
.
time
()
.
'_authP.pem'
,
$this
->
_authenticatorData
->
getPublicKeyPem
());
file_put_contents
(
'apple_'
.
time
()
.
'_nonce.pem'
,
$nonce
);
$keyData
=
openssl_pkey_get_details
(
openssl_pkey_get_public
(
$credCert
));
$keyData
=
openssl_pkey_get_details
(
openssl_pkey_get_public
(
$credCert
));
$key
=
is_array
(
$keyData
)
&&
array_key_exists
(
'key'
,
$keyData
)
?
$keyData
[
'key'
]
:
null
;
$key
=
is_array
(
$keyData
)
&&
array_key_exists
(
'key'
,
$keyData
)
?
$keyData
[
'key'
]
:
null
;
// Verify that nonce equals the value of the extension with OID ( 1.2.840.113635.100.8.2 ) in credCert.
// Verify that nonce equals the value of the extension with OID ( 1.2.840.113635.100.8.2 ) in credCert.
$parsedCredCert
=
openssl_x509_parse
(
$credCert
);
$parsedCredCert
=
openssl_x509_parse
(
$credCert
);
if
(
$parsedCredCert
[
'extensions'
][
'1.2.840.113635.100.8.2'
]
!==
$nonce
)
{
$nonceExtension
=
isset
(
$parsedCredCert
[
'extensions'
][
'1.2.840.113635.100.8.2'
])
?
$parsedCredCert
[
'extensions'
][
'1.2.840.113635.100.8.2'
]
:
''
;
// nonce padded by ASN.1 string: 30 24 A1 22 04 20
// 30 — type tag indicating sequence
// 24 — 36 byte following
// A1 — Enumerated [1]
// 22 — 34 byte following
// 04 — type tag indicating octet string
// 20 — 32 byte following
$asn1Padding
=
"
\x30\x24\xA1\x22\x04\x20
"
;
if
(
substr
(
$nonceExtension
,
0
,
strlen
(
$asn1Padding
))
===
$asn1Padding
)
{
$nonceExtension
=
substr
(
$nonceExtension
,
strlen
(
$asn1Padding
));
}
if
(
$nonceExtension
!==
$nonce
)
{
throw
new
WebAuthnException
(
'nonce doesn\'t equal the value of the extension with OID 1.2.840.113635.100.8.2'
,
WebAuthnException
::
INVALID_DATA
);
throw
new
WebAuthnException
(
'nonce doesn\'t equal the value of the extension with OID 1.2.840.113635.100.8.2'
,
WebAuthnException
::
INVALID_DATA
);
}
}
// Verify that the credential public key equals the Subject Public Key of credCert.
// Verify that the credential public key equals the Subject Public Key of credCert.
$auth
=
openssl_x509_read
(
$this
->
_authenticatorData
->
getPublicKeyPem
());
$authKeyData
=
openssl_pkey_get_details
(
openssl_pkey_get_public
(
$this
->
_authenticatorData
->
getPublicKeyPem
()));
$authKeyData
=
openssl_pkey_get_details
(
openssl_pkey_get_public
(
$auth
));
$authKey
=
is_array
(
$authKeyData
)
&&
array_key_exists
(
'key'
,
$authKeyData
)
?
$authKeyData
[
'key'
]
:
null
;
$authKey
=
is_array
(
$authKeyData
)
&&
array_key_exists
(
'key'
,
$authKeyData
)
?
$authKeyData
[
'key'
]
:
null
;
if
(
$key
===
null
||
$key
!==
$authKey
)
{
if
(
$key
===
null
||
$key
!==
$authKey
)
{
...
...
This diff is collapsed.
Click to expand it.
README.md
+
2
−
2
View file @
d7b27545
[

](https://github.com/lbuchs/WebAuthn/blob/master/LICENSE)
[

](https://github.com/lbuchs/WebAuthn/blob/master/LICENSE)
[

](https://php.net)
[

](https://php.net)
[

](https://github.com/lbuchs/WebAuthn/commits/master)
[

](https://github.com/lbuchs/WebAuthn/commits/master)
# WebAuthn
# WebAuthn
...
@@ -77,7 +77,7 @@ to notify the authenticator that he should save the registration in its memory.
...
@@ -77,7 +77,7 @@ to notify the authenticator that he should save the registration in its memory.
When calling
`WebAuthn\WebAuthn->getGetArgs`
, don't provide any
`$credentialIds`
(the authenticator will look up the ids in its own memory).
When calling
`WebAuthn\WebAuthn->getGetArgs`
, don't provide any
`$credentialIds`
(the authenticator will look up the ids in its own memory).
## Requirements
## Requirements
*
PHP >=
5.6
with
[
OpenSSL
](
http://php.net/manual/en/book.openssl.php
)
*
PHP >=
7.1.0
with
[
OpenSSL
](
http://php.net/manual/en/book.openssl.php
)
*
Browser with
[
WebAuthn support
](
https://caniuse.com/webauthn
)
(
Firefox
60+, Chrome 67+, Opera 54+, Edge 18+)
*
Browser with
[
WebAuthn support
](
https://caniuse.com/webauthn
)
(
Firefox
60+, Chrome 67+, Opera 54+, Edge 18+)
## Infos about WebAuthn
## Infos about WebAuthn
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets