Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
OpenPGP ^5.0.0-5 usa la clave pública de una cadena codificada

Esto no funciona para mí, openPGP simplemente se congela:

 import openpgp from 'openpgp'; const publicKeyArmored = `-----BEGIN PGP PUBLIC KEY BLOCK----- xjMEYLTYzBYJKwYBBAHaRw8BAQdAoatyco6C3CO87ZxgjIfWsFv3RMxs5W1F EinwU2UiQ+bNF3Rlc3QgPHRlc3RAZXhhbXBsZS5vcmc+wowEEBYKAB0FAmC0 2MwECwkHCAMVCAoEFgACAQIZAQIbAwIeAQAhCRC+iM+wNlG7chYhBFZgyLBQ Cavx4mET576Iz7A2UbtyVa8BAP1oFrSwoGdd7+dgBUu7KwU02wvrtuqyURe5 GFSTyMn2AQDWTsJjgYq7hPqSQoeZ30xN0eUoiUiyIA/ffqhM2qHPD844BGC0 2MwSCisGAQQBl1UBBQEBB0CxgKqNlcBTkuaFRvYm/UbR8ZKFFda0tnUCTzl/ tgCsJgMBCAfCeAQYFggACQUCYLTYzAIbDAAhCRC+iM+wNlG7chYhBFZgyLBQ Cavx4mET576Iz7A2UbtysPgA/0pn4n3QqBBc56/okcGFdC78LEwDLN/ZLkY6 azfQ1aqwAP0d9CWw9ywheGtB1SBCzHZbToKaltVFCNT1ArSUFK45Dg== =pnHg -----END PGP PUBLIC KEY BLOCK----- `; let messageEncrypt = await openpgp.encrypt({ message: await openpgp.createMessage({ text: 'test' }), publicKeys: await openpgp.readKeys({ armoredKey: publicKeyArmored }) // This promise never resolves }); console.log(messageEncrypt);

Sin embargo, si leo la clave del disco usando el siguiente enfoque, funciona:

 import { readFileSync } from 'fs'; import openpgp from 'openpgp'; const armoredKeys = readFileSync('./public.key.asc', { encoding: 'utf8', }); let messageEncrypt = await openpgp.encrypt({ message: await openpgp.createMessage({ text: 'test' }), publicKeys: await openpgp.readKeys({ armoredKey: publicKeyArmored }) }); console.log(messageEncrypt); // Totally works

Dado que eventualmente recuperaré la clave de AWS Secrets Manager, tendré que tratarla como una cadena y no como un archivo en el disco. Intenté usar \n nueva línea en la clave de cadena codificada, pero no hay ninguna diferencia.

¿Qué me estoy perdiendo?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!