title: nodejs crypto module privateEncrypt() always return same result
body: <p>I am using RSA encryption with nodejs crypto module.</p>
  
  <p>I want encrypt message with PRIVATE KEY and decrypt with PUBLIC KEY.
  also always make different result with same message using padding scheme like encryption using public key.</p>
  
  <p>So I used basic crypto module like below</p>
  
  <pre><code>var crypto = require('crypto');
  var fs = require('fs');
  const path = require('path');
  
  
  var PRIVKEY = fs.readFileSync(path.join(__dirname, 'private.key'), 'utf8');
  var PUBKEY = fs.readFileSync(path.join(__dirname, 'pub.key'), 'utf8');
  
  // RSA PRIVATE ENCRYPT -&gt; PUBLIC DECRYPT //
  myMSG = "apple";
  console.log('myMSG SIZE:', myMSG.length);
  
  function privENC_pubDEC(originMSG){
   encmsg = crypto.privateEncrypt(PRIVKEY, Buffer.from(originMSG, 'utf8') ).toString('base64');
   msg = crypto.publicDecrypt(PUBKEY, Buffer.from(encmsg, 'base64'));
   console.log("Encrypted with private key : "+encmsg);
   console.log(msg.toString());
  }
  
  // RSA PUBLIC ENCRYPT -&gt; PRVATE DECRYPT //
  function pubENC_privDEC(originMSG){
   encmsg = crypto.publicEncrypt({key:PUBKEY, padding:crypto.constants.RSA_PKCS1_PADDING}, Buffer.from(originMSG, 'utf8') ).toString('base64');
   msg = crypto.privateDecrypt({key:PRIVKEY, padding:crypto.constants.RSA_PKCS1_PADDING}, Buffer.from(encmsg, 'base64'));
   console.log("\nEncrypted with public key : "+encmsg);
   console.log(msg.toString());
  }
  
  privENC_pubDEC(myMSG);
  pubENC_privDEC(myMSG);
  </code></pre>
  
  <p>Result</p>
  
  <pre><code>C:\Users\LSW&gt;node crypto.js
  myMSG SIZE: 5
  Encrypted with private key : fbUZwj+UZP92HQYRc+EJTqSztJTY/Sit5axPZ0NVBuDAC8ZwvvC96pxxDGpra4Yg8MjcXyjvnT8rrrgHu0T0wA==
  apple
  
  Encrypted with public key : ze+5TdWtR8hkpNPIVa5HSasOxs3Pr8FA/1/zUGqDUQmIhs/miWt5pgU9kIAiryKfgGa0+p9RfHPMwZ1VMSA7Bw==
  apple
  
  C:\Users\LSW&gt;node crypto.js
  myMSG SIZE: 5
  Encrypted with private key : fbUZwj+UZP92HQYRc+EJTqSztJTY/Sit5axPZ0NVBuDAC8ZwvvC96pxxDGpra4Yg8MjcXyjvnT8rrrgHu0T0wA==
  apple
  
  Encrypted with public key : OdEpjloUDWI8+YjWkE5cmBC/fJL2QnRLKBXfjaP5h5qyB1OMcm9JGGNSTiAAL2u8O5jjdQAavB9Rn+cdRDjLyA==
  apple
  
  C:\Users\LSW&gt;node crypto.js
  myMSG SIZE: 5
  Encrypted with private key : fbUZwj+UZP92HQYRc+EJTqSztJTY/Sit5axPZ0NVBuDAC8ZwvvC96pxxDGpra4Yg8MjcXyjvnT8rrrgHu0T0wA==
  apple
  
  Encrypted with public key : INspxkyFu2AWGVYwSvOGOPH1fhE3qVVxiqz+SmyHU8wTDNKHj4gVVHqO+8AZOJvi4NfyekI2MMwpFDU4mUjEXA==
  apple
  </code></pre>
  
  <p>PUBLIC ENCRYPT -> PRVATE DECRYPT  is operated well I expected. it always return different result because of padding scheme.</p>
  
  <p>But PRIVATE ENCRYPT -> PUBLIC DECRYPT is always return same message although used padding scheme.</p>
  
  <p>Is there any solution make it different message with Nodejs crypto module???</p>