@@ -798,6 +798,7 @@ public static void writeDSAPublicKey(Writer _out, DSAPublicKey obj) throws IOExc
798
798
out .newLine ();
799
799
out .flush ();
800
800
}
801
+
801
802
/** writes an RSA public key encoded in an PKCS#1 RSA structure. */
802
803
public static void writeRSAPublicKey (Writer _out , RSAPublicKey obj ) throws IOException {
803
804
BufferedWriter out = makeBuffered (_out );
@@ -965,17 +966,18 @@ public static void writeRSAPrivateKey(Writer _out, RSAPrivateCrtKey obj, CipherS
965
966
}
966
967
}
967
968
968
- private static void writePemPlain (BufferedWriter out , String pemHeader , byte [] encoding ) throws IOException {
969
- out .write (BEF_G + pemHeader + AFT );
969
+ private static void writePemPlain (final BufferedWriter out ,
970
+ final String PEM_ID , final byte [] encoding ) throws IOException {
971
+ out .write (BEF_G ); out .write (PEM_ID ); out .write (AFT );
970
972
out .newLine ();
971
973
writeEncoded (out , encoding );
972
- out .write (BEF_E + pemHeader + AFT );
974
+ out .write (BEF_E ); out . write ( PEM_ID ); out . write ( AFT );
973
975
out .newLine ();
974
976
out .flush ();
975
977
}
976
978
977
979
private static void writePemEncrypted (final BufferedWriter out ,
978
- final String pemHeader , final byte [] encoding ,
980
+ final String PEM_ID , final byte [] encoding ,
979
981
final CipherSpec cipherSpec , final char [] passwd ) throws IOException {
980
982
981
983
final Cipher cipher = cipherSpec .getCipher ();
@@ -1003,16 +1005,16 @@ private static void writePemEncrypted(final BufferedWriter out,
1003
1005
catch (GeneralSecurityException e ) {
1004
1006
throw new IOException ("exception using cipher: " + cipherSpec .getOsslName () + " (" + e + ")" , e );
1005
1007
}
1006
- out .write (BEF_G + pemHeader + AFT );
1008
+ out .write (BEF_G ); out . write ( PEM_ID ); out . write ( AFT );
1007
1009
out .newLine ();
1008
1010
out .write ("Proc-Type: 4,ENCRYPTED" );
1009
1011
out .newLine ();
1010
- out .write ("DEK-Info: " + cipherSpec .getOsslName () + "," );
1012
+ out .write ("DEK-Info: " + cipherSpec .getOsslName () + ',' );
1011
1013
writeHexEncoded (out , iv );
1012
1014
out .newLine ();
1013
1015
out .newLine ();
1014
1016
writeEncoded (out , encData );
1015
- out .write (BEF_E + pemHeader + AFT );
1017
+ out .write (BEF_E ); out . write ( PEM_ID ); out . write ( AFT );
1016
1018
out .flush ();
1017
1019
}
1018
1020
0 commit comments