title: Generating a certificate for SOAP header
body: <p>When i try to generate code with:</p>
  
  <pre><code>Certificate cert;
  
                  InputStream path = new FileInputStream(TRUSTSTORE_LOCATION);
                  KeyStore ks = KeyStore.getInstance("JKS");
                  ks.load(path, TRUSTSTORE_PASS.toCharArray());
  
                  // jak argument podaje sie certyfikat ktory jest zawarty w pliku trustory.jks
                  cert = ks.getCertificate("xxxx");
                  binarySecurityTokenElement.addTextNode(new BASE64Encoder().encode(cert.getEncoded()));
                  //kpg = KeyPairGenerator.getInstance("DSA");
                  kpg = KeyPairGenerator.getInstance("RSA");
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>&lt;wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" 
                            Id="X509-7E20D88DE75F0EAADA137595678499810" 
                            ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"&gt;
                                  MIIDXDCCAkSgAwIBAgIEUFbpiDANBgkqhkiG9w0BAQUFADBwMQswCQYDVQQGEwJQTDEQMA4GA1UE&amp;#13;
                                  CBMHVW5rbm93bjENMAsGA1UEBxMETG9kejEVMBMGA1UEChMMQU1HLm5ldCBTLkEuMRUwEwYDVQQL&amp;#13;
                          [...]
  </code></pre>
  
  <p>And in the end of line is this "<code>&amp;#13</code>;", how to delete ??</p>