x509 icon indicating copy to clipboard operation
x509 copied to clipboard

Error: Cannot get schema for 'CertificationRequestInfo' target

Open titanism opened this issue 6 months ago • 0 comments

This error occurs in asn1-schema/build/cjs/schema.js.

Usage:

async function createCsrs(certs, key) {
  const alg = {
    name: 'RSASSA-PKCS1-v1_5',
    hash: 'SHA-1',
    modulusLength: 2048,
    publicExponent: new Uint8Array([1, 0, 1])
  };
  const commonName =
    key === 'Alerts'
      ? 'com.apple.server.apns.alerts'
      : `com.apple.servermgrd.apns.${key.toLowerCase()}`;
  const csr = await X509.Pkcs10CertificateRequestGenerator.create({
    // TODO: pass `serialNumber` re-using existing if renewal occurring
    // const serialNumber = getCertSerialNumber(certs, key);
    default: 'SHA-1',
    name: `CN=${commonName}`,
    keys: {
      publicKey: certs[key].publicKey,
      privateKey: certs[key].privateKey
    },
    // TODO: country name 'US' <------------ required
    signingAlgorithm: alg,
    extensions: []
  });
  return csr.toString('base64');
}

titanism avatar Aug 02 '24 02:08 titanism