DKIM key pair issue (BYODKIM)

0

Hi,

I am trying to create an AWS Ses Email entity for my domain, but the DKIM verification does not pass. DNS records are correct, but still pending.

This is my function to create the key pair:

export function generateDkimPrivateKey(bits = 2048) {
  // Generate RSA key pair
  const { publicKey, privateKey } = crypto.generateKeyPairSync("rsa", {
    modulusLength: 2048,
    publicKeyEncoding: {
      type: "spki",
      format: "pem",
    },
    privateKeyEncoding: {
      type: "pkcs1",
      format: "pem",
    },
  });

  // Extract public key
  const publicKeyString = publicKey.replace(
    /-----BEGIN PUBLIC KEY-----|-----END PUBLIC KEY-----|\r\n|\n/g,
    ""
  );

  // Extract private key and encode as base64
  const privateKeyString = Buffer.from(
    privateKey.replace(
      /-----BEGIN PRIVATE KEY-----|-----END PRIVATE KEY-----|\r\n|\n/g,
      ""
    ),
    "utf-8"
  ).toString("base64");

  return { privateKey: privateKeyString, publicKey: publicKeyString };
}

I also get this message:

VerificationInfo: {
    ErrorType: 'INVALID_VALUE',
...
}

I am using @aws-sdk/client-sesv2 in nodejs env Please help

Andras
asked 14 days ago71 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions