Files
apache
wp-content
mu-plugins
plugins
activitypub
audioigniter
authldap
companion-auto-update
disable-wordpress-core-update
easy-digital-downloads
gitium
gp-premium
jetpack-protect
menu-icons
simple-local-avatars
smtp-mailer
two-factor
wp-piwik
wp-webauthn
blocks
css
js
languages
vendor
beberlei
brick
composer
fgrosse
league
nyholm
php-http
psr
ramsey
spomky-labs
symfony
thecodingmachine
web-auth
web-token
jwt-core
jwt-key-mgmt
.github
Analyzer
AlgorithmAnalyzer.php
ES256KeyAnalyzer.php
ES384KeyAnalyzer.php
ES512KeyAnalyzer.php
HS256KeyAnalyzer.php
HS384KeyAnalyzer.php
HS512KeyAnalyzer.php
KeyAnalyzer.php
KeyAnalyzerManager.php
KeyIdentifierAnalyzer.php
KeysetAnalyzer.php
KeysetAnalyzerManager.php
Message.php
MessageBag.php
MixedKeyTypes.php
MixedPublicAndPrivateKeys.php
NoneAnalyzer.php
OctAnalyzer.php
RsaAnalyzer.php
UsageAnalyzer.php
ZxcvbnKeyAnalyzer.php
KeyConverter
JKUFactory.php
JWKFactory.php
LICENSE
README.md
UrlKeySetFactory.php
X5UFactory.php
composer.json
jwt-signature
jwt-signature-algorithm-ecdsa
jwt-signature-algorithm-eddsa
jwt-signature-algorithm-rsa
autoload.php
LICENSE
readme.txt
wp-webauthn.php
wwa-admin-content.php
wwa-ajax.php
wwa-compatibility.php
wwa-functions.php
wwa-menus.php
wwa-profile-content.php
wwa-shortcodes.php
wwa-version.php
index.php
themes
index.php
.dbsetup
.gitignore
htaccess
php.ini

33 lines
748 B
PHP

<?php
declare(strict_types=1);
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2020 Spomky-Labs
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
namespace Jose\Component\KeyManagement\Analyzer;
use Base64Url\Base64Url;
use Jose\Component\Core\JWK;
final class OctAnalyzer implements KeyAnalyzer
{
public function analyze(JWK $jwk, MessageBag $bag): void
{
if ('oct' !== $jwk->get('kty')) {
return;
}
$k = Base64Url::decode($jwk->get('k'));
$kLength = 8 * mb_strlen($k, '8bit');
if ($kLength < 128) {
$bag->add(Message::high('The key length is less than 128 bits.'));
}
}
}