PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.3.0
Defender Security – Malware Scanner, Login Security & Firewall v6.3.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / lib / packages / Webauthn / U2FPublicKey.php

U2FPublicKey.php in Defender Security – Malware Scanner, Login Security & Firewall 6.3.0, at lib/packages/Webauthn/U2FPublicKey.php

47 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WP_DEFENDER_VENDOR\Webauthn;
4
5 use WP_DEFENDER_VENDOR\CBOR\ByteStringObject;
6 use WP_DEFENDER_VENDOR\CBOR\MapItem;
7 use WP_DEFENDER_VENDOR\CBOR\MapObject;
8 use WP_DEFENDER_VENDOR\CBOR\NegativeIntegerObject;
9 use WP_DEFENDER_VENDOR\CBOR\UnsignedIntegerObject;
10
11 class U2FPublicKey
12 {
13 public static function isU2FKey($publicKey): bool
14 {
15 return $publicKey[0] === "\x04";
16 }
17
18 public static function createCOSEKey($publicKey): string
19 {
20
21 $mapObject = new MapObject([
22 1 => MapItem::create(
23 new UnsignedIntegerObject(1, null),
24 new UnsignedIntegerObject(2, null)
25 ),
26 3 => MapItem::create(
27 new UnsignedIntegerObject(3, null),
28 new NegativeIntegerObject(6, null)
29 ),
30 -1 => MapItem::create(
31 new NegativeIntegerObject(0, null),
32 new UnsignedIntegerObject(1, null)
33 ),
34 -2 => MapItem::create(
35 new NegativeIntegerObject(1, null),
36 new ByteStringObject(substr($publicKey, 1, 32))
37 ),
38 -3 => MapItem::create(
39 new NegativeIntegerObject(2, null),
40 new ByteStringObject(substr($publicKey, 33))
41 ),
42 ]);
43
44 return $mapObject->__toString();
45 }
46 }
47