updated plugin WP-WebAuthn
version 1.3.1
This commit is contained in:
wp-content/plugins/wp-webauthn
css
js
languages
template.potwp-webauthn-ca_ES.mowp-webauthn-ca_ES.powp-webauthn-es_ES.mowp-webauthn-es_ES.powp-webauthn-it_IT.mowp-webauthn-it_IT.po
readme.txtvendor
autoload.php
composer
fgrosse
phpasn1
league
php-http
message-factory
psr
http-factory
ramsey
collection
symfony
polyfill-php80
polyfill-php81
Resources
wp-webauthn-vendor
autoload.php
wp-webauthn.phpwwa-admin-content.phpwwa-ajax.phpwwa-functions.phpwwa-profile-content.phpwwa-shortcodes.phpwwa-version.phpbeberlei
assert
brick
math
composer
ClassLoader.phpInstalledVersions.phpLICENSEautoload_classmap.phpautoload_files.phpautoload_namespaces.phpautoload_psr4.phpautoload_real.phpautoload_static.phpinstalled.jsoninstalled.php
fgrosse
phpasn1
CHANGELOG.mdLICENSEREADME.mdcomposer.json
lib
ASN1
ASNObject.phpAbstractString.phpAbstractTime.phpBase128.php
Composite
Construct.phpException
ExplicitlyTaggedObject.phpIdentifier.phpOID.phpParsable.phpTemplateParser.phpUniversal
BMPString.phpBitString.phpBoolean.phpCharacterString.phpEnumerated.phpGeneralString.phpGeneralizedTime.phpGraphicString.phpIA5String.phpInteger.phpNullObject.phpNumericString.phpObjectDescriptor.phpObjectIdentifier.phpOctetString.phpPrintableString.phpRelativeObjectIdentifier.phpSequence.phpSet.phpT61String.phpUTCTime.phpUTF8String.phpUniversalString.phpVisibleString.php
UnknownConstructedObject.phpUnknownObject.phpUtility
X509
league
uri-interfaces
LICENSEcomposer.json
src
Contracts
AuthorityInterface.phpDataPathInterface.phpDomainHostInterface.phpFragmentInterface.phpHostInterface.phpIpHostInterface.phpPathInterface.phpPortInterface.phpQueryInterface.phpSegmentedPathInterface.phpUriComponentInterface.phpUriException.phpUriInterface.phpUserInfoInterface.php
Exceptions
Idna
uri
nyholm
psr
http-client
http-factory
http-message
log
ramsey
collection
LICENSEREADME.mdSECURITY.mdcomposer.jsonconventional-commits.json
src
AbstractArray.phpAbstractCollection.phpAbstractSet.phpArrayInterface.phpCollection.phpCollectionInterface.phpDoubleEndedQueue.phpDoubleEndedQueueInterface.php
Exception
CollectionMismatchException.phpInvalidArgumentException.phpInvalidSortOrderException.phpNoSuchElementException.phpOutOfBoundsException.phpUnsupportedOperationException.phpValueExtractionException.php
GenericArray.phpMap
AbstractMap.phpAbstractTypedMap.phpAssociativeArrayMap.phpMapInterface.phpNamedParameterMap.phpTypedMap.phpTypedMapInterface.php
Queue.phpQueueInterface.phpSet.phpTool
uuid
LICENSEREADME.mdcomposer.json
src
BinaryUtils.php
Builder
BuilderCollection.phpDefaultUuidBuilder.phpDegradedUuidBuilder.phpFallbackBuilder.phpUuidBuilderInterface.php
Codec
CodecInterface.phpGuidStringCodec.phpOrderedTimeCodec.phpStringCodec.phpTimestampFirstCombCodec.phpTimestampLastCombCodec.php
Converter
DegradedUuid.phpDeprecatedUuidInterface.phpDeprecatedUuidMethodsTrait.phpException
BuilderNotFoundException.phpDateTimeException.phpDceSecurityException.phpInvalidArgumentException.phpInvalidBytesException.phpInvalidUuidStringException.phpNameException.phpNodeException.phpRandomSourceException.phpTimeSourceException.phpUnableToBuildUuidException.phpUnsupportedOperationException.phpUuidExceptionInterface.php
FeatureSet.phpFields
Generator
CombGenerator.phpDceSecurityGenerator.phpDceSecurityGeneratorInterface.phpDefaultNameGenerator.phpDefaultTimeGenerator.phpNameGeneratorFactory.phpNameGeneratorInterface.phpPeclUuidNameGenerator.phpPeclUuidRandomGenerator.phpPeclUuidTimeGenerator.phpRandomBytesGenerator.phpRandomGeneratorFactory.phpRandomGeneratorInterface.phpRandomLibAdapter.phpTimeGeneratorFactory.phpTimeGeneratorInterface.php
Guid
Lazy
Math
Nonstandard
Provider
Dce
DceSecurityProviderInterface.phpNode
FallbackNodeProvider.phpNodeProviderCollection.phpRandomNodeProvider.phpStaticNodeProvider.phpSystemNodeProvider.php
NodeProviderInterface.phpTime
TimeProviderInterface.phpRfc4122
Fields.phpFieldsInterface.phpNilTrait.phpNilUuid.phpUuidBuilder.phpUuidInterface.phpUuidV1.phpUuidV2.phpUuidV3.phpUuidV4.phpUuidV5.phpValidator.phpVariantTrait.phpVersionTrait.php
Type
Uuid.phpUuidFactory.phpUuidFactoryInterface.phpUuidInterface.phpValidator
functions.phpspomky-labs
base64url
cbor-php
LICENSEcomposer.json
src
AbstractCBORObject.phpByteStringObject.phpByteStringWithChunkObject.phpCBORObject.phpDecoder.phpDecoderInterface.phpIndefiniteLengthByteStringObject.phpIndefiniteLengthListObject.phpIndefiniteLengthMapObject.phpIndefiniteLengthTextStringObject.phpInfiniteListObject.phpInfiniteMapObject.phpLengthCalculator.phpListObject.phpMapItem.phpMapObject.phpNegativeIntegerObject.phpNormalizable.phpOtherObject.php
OtherObject
BreakObject.phpDoublePrecisionFloatObject.phpFalseObject.phpGenericObject.phpHalfPrecisionFloatObject.phpNullObject.phpOtherObjectManager.phpOtherObjectManagerInterface.phpSimpleObject.phpSinglePrecisionFloatObject.phpTrueObject.phpUndefinedObject.php
SignedIntegerObject.phpStream.phpStringStream.phpTag.phpTag
Base16EncodingTag.phpBase64EncodingTag.phpBase64Tag.phpBase64UrlEncodingTag.phpBase64UrlTag.phpBigFloatTag.phpCBOREncodingTag.phpCBORTag.phpDatetimeTag.phpDecimalFractionTag.phpEpochTag.phpGenericTag.phpMimeTag.phpNegativeBigIntegerTag.phpPositiveBigIntegerTag.phpTagManager.phpTagManagerInterface.phpTagObjectManager.phpTimestampTag.phpUnsignedBigIntegerTag.phpUriTag.php
TagObject.phpTextStringObject.phpTextStringWithChunkObject.phpUnsignedIntegerObject.phpUtils.phpsymfony
polyfill-ctype
polyfill-php80
polyfill-php81
process
CHANGELOG.md
Exception
ExceptionInterface.phpInvalidArgumentException.phpLogicException.phpProcessFailedException.phpProcessSignaledException.phpProcessTimedOutException.phpRuntimeException.php
ExecutableFinder.phpInputStream.phpLICENSEPhpExecutableFinder.phpPhpProcess.phpPipes
Process.phpProcessUtils.phpREADME.mdcomposer.jsonthecodingmachine
safe
LICENSEREADME.mdcomposer.json
deprecated
generated
Exceptions
.gitkeepApacheException.phpApcuException.phpArrayException.phpBzip2Exception.phpCalendarException.phpClassobjException.phpComException.phpCubridException.phpDatetimeException.phpDirException.phpEioException.phpErrorfuncException.phpExecException.phpFileinfoException.phpFilesystemException.phpFilterException.phpFpmException.phpFtpException.phpFunchandException.phpGmpException.phpGnupgException.phpHashException.phpIbaseException.phpIbmDb2Exception.phpIconvException.phpImageException.phpImapException.phpInfoException.phpIngresiiException.phpInotifyException.phpLdapException.phpLibxmlException.phpLzfException.phpMailparseException.phpMbstringException.phpMiscException.phpMsqlException.phpMysqlException.phpMysqliException.phpMysqlndMsException.phpMysqlndQcException.phpNetworkException.phpOci8Exception.phpOpcacheException.phpOutcontrolException.phpPasswordException.phpPcntlException.phpPdfException.phpPgsqlException.phpPosixException.phpPsException.phpPspellException.phpReadlineException.phpRpminfoException.phpRrdException.phpSemException.phpSessionException.phpShmopException.phpSimplexmlException.phpSocketsException.phpSodiumException.phpSolrException.phpSplException.phpSqlsrvException.phpSsdeepException.phpSsh2Exception.phpStreamException.phpStringsException.phpSwooleException.phpUodbcException.phpUopzException.phpUrlException.phpVarException.phpXdiffException.phpXmlException.phpXmlrpcException.phpYamlException.phpYazException.phpZipException.phpZlibException.php
apache.phpapcu.phparray.phpbzip2.phpcalendar.phpclassobj.phpcom.phpcubrid.phpcurl.phpdatetime.phpdir.phpeio.phperrorfunc.phpexec.phpfileinfo.phpfilesystem.phpfilter.phpfpm.phpftp.phpfunchand.phpfunctionsList.phpgmp.phpgnupg.phphash.phpibase.phpibmDb2.phpiconv.phpimage.phpimap.phpinfo.phpingres-ii.phpinotify.phpjson.phpldap.phplibxml.phplzf.phpmailparse.phpmbstring.phpmisc.phpmsql.phpmysql.phpmysqli.phpmysqlndMs.phpmysqlndQc.phpnetwork.phpoci8.phpopcache.phpopenssl.phpoutcontrol.phppassword.phppcntl.phppcre.phppdf.phppgsql.phpposix.phpps.phppspell.phpreadline.phprpminfo.phprrd.phpsem.phpsession.phpshmop.phpsimplexml.phpsockets.phpsodium.phpsolr.phpspl.phpsqlsrv.phpssdeep.phpssh2.phpstream.phpstrings.phpswoole.phpuodbc.phpuopz.phpurl.phpvar.phpxdiff.phpxml.phpxmlrpc.phpyaml.phpyaz.phpzip.phpzlib.phplib
rector-migrate-0.7.phpweb-auth
cose-lib
LICENSEcomposer.json
src
Algorithm
Algorithms.phpBigInteger.phpHash.phpKey
Verifier.phpmetadata-service
LICENSEcomposer.json
src
AbstractDescriptor.phpAuthenticatorStatus.phpBiometricAccuracyDescriptor.phpBiometricStatusReport.phpCodeAccuracyDescriptor.phpDisplayPNGCharacteristicsDescriptor.phpDistantSingleMetadata.phpEcdaaTrustAnchor.phpExtensionDescriptor.phpMetadataService.phpMetadataStatement.phpMetadataStatementFetcher.phpMetadataStatementRepository.phpMetadataTOCPayload.phpMetadataTOCPayloadEntry.phpPatternAccuracyDescriptor.phpRgbPaletteEntry.phpRogueListEntry.phpSingleMetadata.phpStatusReport.phpUtils.phpVerificationMethodANDCombinations.phpVerificationMethodDescriptor.phpVersion.php
webauthn-lib
LICENSEcomposer.json
src
AttestationStatement
AndroidKeyAttestationStatementSupport.phpAndroidSafetyNetAttestationStatementSupport.phpAppleAttestationStatementSupport.phpAttestationObject.phpAttestationObjectLoader.phpAttestationStatement.phpAttestationStatementSupport.phpAttestationStatementSupportManager.phpFidoU2FAttestationStatementSupport.phpNoneAttestationStatementSupport.phpPackedAttestationStatementSupport.phpTPMAttestationStatementSupport.php
AttestedCredentialData.phpAuthenticationExtensions
AuthenticationExtension.phpAuthenticationExtensionsClientInputs.phpAuthenticationExtensionsClientOutputs.phpAuthenticationExtensionsClientOutputsLoader.phpExtensionOutputChecker.phpExtensionOutputCheckerHandler.phpExtensionOutputError.php
AuthenticatorAssertionResponse.phpAuthenticatorAssertionResponseValidator.phpAuthenticatorAttestationResponse.phpAuthenticatorAttestationResponseValidator.phpAuthenticatorData.phpAuthenticatorResponse.phpAuthenticatorSelectionCriteria.phpCertificateChainChecker
CertificateToolbox.phpCollectedClientData.phpCounter
Credential.phpPublicKeyCredential.phpPublicKeyCredentialCreationOptions.phpPublicKeyCredentialDescriptor.phpPublicKeyCredentialDescriptorCollection.phpPublicKeyCredentialEntity.phpPublicKeyCredentialLoader.phpPublicKeyCredentialOptions.phpPublicKeyCredentialParameters.phpPublicKeyCredentialRequestOptions.phpPublicKeyCredentialRpEntity.phpPublicKeyCredentialSource.phpPublicKeyCredentialSourceRepository.phpPublicKeyCredentialUserEntity.phpServer.phpStringStream.phpTokenBinding
IgnoreTokenBindingHandler.phpSecTokenBindingHandler.phpTokenBinding.phpTokenBindingHandler.phpTokenBindingNotSupportedHandler.php
TrustPath
U2FPublicKey.phpUtil
web-token
jwt-core
.github
Algorithm.phpAlgorithmManager.phpAlgorithmManagerFactory.phpJWK.phpJWKSet.phpJWT.phpLICENSEREADME.mdUtil
composer.jsonjwt-key-mgmt
.github
Analyzer
AlgorithmAnalyzer.phpES256KeyAnalyzer.phpES384KeyAnalyzer.phpES512KeyAnalyzer.phpHS256KeyAnalyzer.phpHS384KeyAnalyzer.phpHS512KeyAnalyzer.phpKeyAnalyzer.phpKeyAnalyzerManager.phpKeyIdentifierAnalyzer.phpKeysetAnalyzer.phpKeysetAnalyzerManager.phpMessage.phpMessageBag.phpMixedKeyTypes.phpMixedPublicAndPrivateKeys.phpNoneAnalyzer.phpOctAnalyzer.phpRsaAnalyzer.phpUsageAnalyzer.phpZxcvbnKeyAnalyzer.php
JKUFactory.phpJWKFactory.phpKeyConverter
LICENSEREADME.mdUrlKeySetFactory.phpX5UFactory.phpcomposer.jsonjwt-signature-algorithm-ecdsa
jwt-signature-algorithm-eddsa
jwt-signature-algorithm-rsa
.github
LICENSEPS256.phpPS384.phpPS512.phpREADME.mdRS256.phpRS384.phpRS512.phpRSA.phpRSAPKCS1.phpRSAPSS.phpUtil
composer.jsonjwt-signature
.github
Algorithm
JWS.phpJWSBuilder.phpJWSBuilderFactory.phpJWSLoader.phpJWSLoaderFactory.phpJWSTokenSupport.phpJWSVerifier.phpJWSVerifierFactory.phpLICENSEREADME.mdSerializer
CompactSerializer.phpJSONFlattenedSerializer.phpJSONGeneralSerializer.phpJWSSerializer.phpJWSSerializerManager.phpJWSSerializerManagerFactory.phpSerializer.php
Signature.phpcomposer.json
223
wp-content/plugins/wp-webauthn/wp-webauthn-vendor/web-auth/webauthn-lib/src/CertificateToolbox.php
Normal file
223
wp-content/plugins/wp-webauthn/wp-webauthn-vendor/web-auth/webauthn-lib/src/CertificateToolbox.php
Normal file
@ -0,0 +1,223 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014-2021 Spomky-Labs
|
||||
*
|
||||
* This software may be modified and distributed under the terms
|
||||
* of the MIT license. See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Webauthn;
|
||||
|
||||
use Assert\Assertion;
|
||||
use function count;
|
||||
use function in_array;
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
use Safe\Exceptions\FilesystemException;
|
||||
use function Safe\file_put_contents;
|
||||
use function Safe\ksort;
|
||||
use function Safe\mkdir;
|
||||
use function Safe\rename;
|
||||
use function Safe\sprintf;
|
||||
use function Safe\tempnam;
|
||||
use function Safe\unlink;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
class CertificateToolbox
|
||||
{
|
||||
/**
|
||||
* @deprecated "This method is deprecated since v3.3 and will be removed en v4.0. Please use Webauthn\CertificateChainChecker\CertificateChainChecker instead"
|
||||
*
|
||||
* @param string[] $authenticatorCertificates
|
||||
* @param string[] $trustedCertificates
|
||||
*/
|
||||
public static function checkChain(array $authenticatorCertificates, array $trustedCertificates = []): void
|
||||
{
|
||||
if (0 === count($trustedCertificates)) {
|
||||
self::checkCertificatesValidity($authenticatorCertificates, true);
|
||||
|
||||
return;
|
||||
}
|
||||
self::checkCertificatesValidity($authenticatorCertificates, false);
|
||||
|
||||
$processArguments = ['-no-CAfile', '-no-CApath'];
|
||||
|
||||
$caDirname = self::createTemporaryDirectory();
|
||||
$processArguments[] = '--CApath';
|
||||
$processArguments[] = $caDirname;
|
||||
|
||||
foreach ($trustedCertificates as $certificate) {
|
||||
self::prepareCertificate($caDirname, $certificate, 'webauthn-trusted-', '.pem');
|
||||
}
|
||||
|
||||
$rehashProcess = new Process(['openssl', 'rehash', $caDirname]);
|
||||
$rehashProcess->run();
|
||||
while ($rehashProcess->isRunning()) {
|
||||
//Just wait
|
||||
}
|
||||
if (!$rehashProcess->isSuccessful()) {
|
||||
throw new InvalidArgumentException('Invalid certificate or certificate chain');
|
||||
}
|
||||
|
||||
$filenames = [];
|
||||
$leafCertificate = array_shift($authenticatorCertificates);
|
||||
$leafFilename = self::prepareCertificate(sys_get_temp_dir(), $leafCertificate, 'webauthn-leaf-', '.pem');
|
||||
$filenames[] = $leafFilename;
|
||||
|
||||
foreach ($authenticatorCertificates as $certificate) {
|
||||
$untrustedFilename = self::prepareCertificate(sys_get_temp_dir(), $certificate, 'webauthn-untrusted-', '.pem');
|
||||
$processArguments[] = '-untrusted';
|
||||
$processArguments[] = $untrustedFilename;
|
||||
$filenames[] = $untrustedFilename;
|
||||
}
|
||||
|
||||
$processArguments[] = $leafFilename;
|
||||
array_unshift($processArguments, 'openssl', 'verify');
|
||||
|
||||
$process = new Process($processArguments);
|
||||
$process->run();
|
||||
while ($process->isRunning()) {
|
||||
//Just wait
|
||||
}
|
||||
|
||||
foreach ($filenames as $filename) {
|
||||
try {
|
||||
unlink($filename);
|
||||
} catch (FilesystemException $e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
self::deleteDirectory($caDirname);
|
||||
|
||||
if (!$process->isSuccessful()) {
|
||||
throw new InvalidArgumentException('Invalid certificate or certificate chain');
|
||||
}
|
||||
}
|
||||
|
||||
public static function fixPEMStructure(string $certificate, string $type = 'CERTIFICATE'): string
|
||||
{
|
||||
$pemCert = '-----BEGIN '.$type.'-----'.PHP_EOL;
|
||||
$pemCert .= chunk_split($certificate, 64, PHP_EOL);
|
||||
$pemCert .= '-----END '.$type.'-----'.PHP_EOL;
|
||||
|
||||
return $pemCert;
|
||||
}
|
||||
|
||||
public static function convertDERToPEM(string $certificate, string $type = 'CERTIFICATE'): string
|
||||
{
|
||||
$derCertificate = self::unusedBytesFix($certificate);
|
||||
|
||||
return self::fixPEMStructure(base64_encode($derCertificate), $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $certificates
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public static function convertAllDERToPEM(array $certificates, string $type = 'CERTIFICATE'): array
|
||||
{
|
||||
$certs = [];
|
||||
foreach ($certificates as $publicKey) {
|
||||
$certs[] = self::convertDERToPEM($publicKey, $type);
|
||||
}
|
||||
|
||||
return $certs;
|
||||
}
|
||||
|
||||
private static function unusedBytesFix(string $certificate): string
|
||||
{
|
||||
$certificateHash = hash('sha256', $certificate);
|
||||
if (in_array($certificateHash, self::getCertificateHashes(), true)) {
|
||||
$certificate[mb_strlen($certificate, '8bit') - 257] = "\0";
|
||||
}
|
||||
|
||||
return $certificate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $certificates
|
||||
*/
|
||||
private static function checkCertificatesValidity(array $certificates, bool $allowRootCertificate): void
|
||||
{
|
||||
foreach ($certificates as $certificate) {
|
||||
$parsed = openssl_x509_parse($certificate);
|
||||
Assertion::isArray($parsed, 'Unable to read the certificate');
|
||||
if (false === $allowRootCertificate) {
|
||||
self::checkRootCertificate($parsed);
|
||||
}
|
||||
|
||||
Assertion::keyExists($parsed, 'validTo_time_t', 'The certificate has no validity period');
|
||||
Assertion::keyExists($parsed, 'validFrom_time_t', 'The certificate has no validity period');
|
||||
Assertion::lessOrEqualThan(time(), $parsed['validTo_time_t'], 'The certificate expired');
|
||||
Assertion::greaterOrEqualThan(time(), $parsed['validFrom_time_t'], 'The certificate is not usable yet');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $parsed
|
||||
*/
|
||||
private static function checkRootCertificate(array $parsed): void
|
||||
{
|
||||
Assertion::keyExists($parsed, 'subject', 'The certificate has no subject');
|
||||
Assertion::keyExists($parsed, 'issuer', 'The certificate has no issuer');
|
||||
$subject = $parsed['subject'];
|
||||
$issuer = $parsed['issuer'];
|
||||
ksort($subject);
|
||||
ksort($issuer);
|
||||
Assertion::notEq($subject, $issuer, 'Root certificates are not allowed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private static function getCertificateHashes(): array
|
||||
{
|
||||
return [
|
||||
'349bca1031f8c82c4ceca38b9cebf1a69df9fb3b94eed99eb3fb9aa3822d26e8',
|
||||
'dd574527df608e47ae45fbba75a2afdd5c20fd94a02419381813cd55a2a3398f',
|
||||
'1d8764f0f7cd1352df6150045c8f638e517270e8b5dda1c63ade9c2280240cae',
|
||||
'd0edc9a91a1677435a953390865d208c55b3183c6759c9b5a7ff494c322558eb',
|
||||
'6073c436dcd064a48127ddbf6032ac1a66fd59a0c24434f070d4e564c124c897',
|
||||
'ca993121846c464d666096d35f13bf44c1b05af205f9b4a1e00cf6cc10c5e511',
|
||||
];
|
||||
}
|
||||
|
||||
private static function createTemporaryDirectory(): string
|
||||
{
|
||||
$caDir = tempnam(sys_get_temp_dir(), 'webauthn-ca-');
|
||||
if (file_exists($caDir)) {
|
||||
unlink($caDir);
|
||||
}
|
||||
mkdir($caDir);
|
||||
if (!is_dir($caDir)) {
|
||||
throw new RuntimeException(sprintf('Directory "%s" was not created', $caDir));
|
||||
}
|
||||
|
||||
return $caDir;
|
||||
}
|
||||
|
||||
private static function deleteDirectory(string $dirname): void
|
||||
{
|
||||
$rehashProcess = new Process(['rm', '-rf', $dirname]);
|
||||
$rehashProcess->run();
|
||||
while ($rehashProcess->isRunning()) {
|
||||
//Just wait
|
||||
}
|
||||
}
|
||||
|
||||
private static function prepareCertificate(string $folder, string $certificate, string $prefix, string $suffix): string
|
||||
{
|
||||
$untrustedFilename = tempnam($folder, $prefix);
|
||||
rename($untrustedFilename, $untrustedFilename.$suffix);
|
||||
file_put_contents($untrustedFilename.$suffix, $certificate, FILE_APPEND);
|
||||
file_put_contents($untrustedFilename.$suffix, PHP_EOL, FILE_APPEND);
|
||||
|
||||
return $untrustedFilename.$suffix;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user