code: public void encode(OutputStream out) throws IOException {
          DerOutputStream tmp = new DerOutputStream();
          tmp.write(key.getEncoded());
  
          out.write(tmp.toByteArray());
      }
docs: Encode the key in DER form to the stream.
  
  @param out the OutputStream to marshal the contents to.
  @exception IOException on errors.