src/java.base/share/classes/com/sun/crypto/provider/DHParameters.java

Print this page
rev 10521 : 8055723[core]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>


 114         bytes.putInteger(this.g);
 115         // Private-value length is OPTIONAL
 116         if (this.l > 0) {
 117             bytes.putInteger(this.l);
 118         }
 119         out.write(DerValue.tag_Sequence, bytes);
 120         return out.toByteArray();
 121     }
 122 
 123     protected byte[] engineGetEncoded(String encodingMethod)
 124         throws IOException {
 125             return engineGetEncoded();
 126     }
 127 
 128     /*
 129      * Returns a formatted string describing the parameters.
 130      */
 131     protected String engineToString() {
 132         String LINE_SEP = System.getProperty("line.separator");
 133 
 134         StringBuilder sb
 135             = new StringBuilder("SunJCE Diffie-Hellman Parameters:"
 136                                + LINE_SEP + "p:" + LINE_SEP
 137                                + Debug.toHexString(this.p)
 138                                + LINE_SEP + "g:" + LINE_SEP
 139                                + Debug.toHexString(this.g));
 140         if (this.l != 0)
 141             sb.append(LINE_SEP + "l:" + LINE_SEP + "    " + this.l);


 142         return sb.toString();
 143     }
 144 }


 114         bytes.putInteger(this.g);
 115         // Private-value length is OPTIONAL
 116         if (this.l > 0) {
 117             bytes.putInteger(this.l);
 118         }
 119         out.write(DerValue.tag_Sequence, bytes);
 120         return out.toByteArray();
 121     }
 122 
 123     protected byte[] engineGetEncoded(String encodingMethod)
 124         throws IOException {
 125             return engineGetEncoded();
 126     }
 127 
 128     /*
 129      * Returns a formatted string describing the parameters.
 130      */
 131     protected String engineToString() {
 132         String LINE_SEP = System.getProperty("line.separator");
 133 
 134         StringBuilder sb = new StringBuilder();
 135         sb.append("SunJCE Diffie-Hellman Parameters:").append(LINE_SEP)
 136                 .append("p:").append(LINE_SEP)
 137                 .append(Debug.toHexString(this.p)).append(LINE_SEP)
 138                 .append("g:").append(LINE_SEP)
 139                 .append(Debug.toHexString(this.g));
 140         if (this.l != 0) {
 141             sb.append(LINE_SEP).append("l:").append(LINE_SEP).append("    ")
 142                     .append(this.l);
 143         }
 144         return sb.toString();
 145     }
 146 }