Software: Apache. PHP/7.3.33 uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) Safe-mode: OFF (not secure) /opt/alt/alt-nodejs19/root/usr/lib/node_modules/npm/node_modules.bundled/sigstore/dist/ drwxr-xr-x |
Viewing file: Select action/file-type: "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Signer = void 0; const util_1 = require("./util"); class Signer { constructor(options) { this.identityProviders = []; this.ca = options.ca; this.tlog = options.tlog; this.identityProviders = options.identityProviders; this.signer = options.signer || this.signWithEphemeralKey.bind(this); } async signBlob(payload) { // Get signature and verification material for payload const sigMaterial = await this.signer(payload); // Calculate artifact digest const digest = util_1.crypto.hash(payload); // Create Rekor entry return this.tlog.createMessageSignatureEntry(digest, sigMaterial); } async signAttestation(payload, payloadType) { // Pre-authentication encoding to be signed const paeBuffer = util_1.dsse.preAuthEncoding(payloadType, payload); // Get signature and verification material for pae const sigMaterial = await this.signer(paeBuffer); const envelope = { payloadType, payload: payload, signatures: [ { keyid: sigMaterial.key?.id || '', sig: sigMaterial.signature, }, ], }; return this.tlog.createDSSEEntry(envelope, sigMaterial); } async signWithEphemeralKey(payload) { // Create emphemeral key pair const keypair = util_1.crypto.generateKeyPair(); // Retrieve identity token from one of the supplied identity providers const identityToken = await this.getIdentityToken(); // Extract challenge claim from OIDC token const subject = util_1.oidc.extractJWTSubject(identityToken); // Construct challenge value by encrypting subject with private key const challenge = util_1.crypto.signBlob(Buffer.from(subject), keypair.privateKey); // Create signing certificate const certificates = await this.ca.createSigningCertificate(identityToken, keypair.publicKey, challenge); // Generate artifact signature const signature = util_1.crypto.signBlob(payload, keypair.privateKey); return { signature, certificates, key: undefined, }; } async getIdentityToken() { const aggErrs = []; for (const provider of this.identityProviders) { try { const token = await provider.getToken(); if (token) { return token; } } catch (err) { aggErrs.push(err); } } throw new Error(`Identity token providers failed: ${aggErrs}`); } } exports.Signer = Signer; |
:: Command execute :: | |
--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.004 ]-- |