Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

341
Vistas
How to sign a text file using X509 certificate in Java?

I have exported a class 3 Digital certificate and I am able to get the details from the object named cert as seen below. I intend to sign a text file using this certificate. However since I exported this certificate without the private key, I am unable to proceed. I have shared a snippet below the image which has tags.

This is the file saved as .txt and the tags and will be the result of the signing process. So basically the raw payload will only have the other tags before the signing process.

My Questions:

  1. Am I on the right track to digitally sign the text file from backend?

  2. Should the access of the certificate be handled on the client side using Javascript

     try (InputStream inStream = new FileInputStream("D:\\New folder\\TestCertificate.cer")) {
          CertificateFactory cf = CertificateFactory.getInstance("X.509");
          X509Certificate cert = (X509Certificate)cf.generateCertificate(inStream);
    
          cert.checkValidity();
          System.out.println("This is public key :  " + cert.getPublicKey());
          System.out.println("This is certificate type: " + cert.getType());
    
          // Code to access a txt file and sign it with the certificate.
    
      } catch (CertificateException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
     } catch (FileNotFoundException e1) {
         // TODO Auto-generated catch block
         e1.printStackTrace();
     } catch (IOException e1) {
         // TODO Auto-generated catch block
         e1.printStackTrace();
     }
    

enter image description here

<MessageInfo>
<SenderIden>XSB000000000</SenderIden>
<SenderSP>100023193</SenderSP>
<Data><![CDATA[{IFN515}{XSB000000000}{XYZ12345} 
  {
  :16R:GENL
  :20C::SEME//A23P8W4
  :23G:NEWM
  :98A::PREP//20220221
  :22F::TRTR//TRAD
   ]]></Data>
  <SubscriberDS>MIIJuwYJKoZIhvcNAQcCoI</SubscriberDS>
  <ServiceProviderDS>MIIJuwYJKoZI</ServiceProviderDS>
  </MessageInfo>
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda