@@ -189,10 +189,18 @@ private static BufferedWriter makeBuffered(Writer out) {
189189 }
190190
191191 /**
192- * c: PEM_X509_INFO_read_bio
192+ * @deprecated Prefer passing in a buffered-reader esp. in loops as the
193+ * method might return a X.509 object before reading the full PEM file !
193194 */
194195 public static Object readPEM (final Reader in , final char [] passwd ) throws IOException {
195- final BufferedReader reader = makeBuffered (in ); String line ;
196+ return readPEM (makeBuffered (in ), passwd );
197+ }
198+
199+ /**
200+ * c: PEM_X509_INFO_read_bio
201+ */
202+ public static Object readPEM (final BufferedReader reader , final char [] passwd ) throws IOException {
203+ String line ;
196204 while ( ( line = reader .readLine () ) != null ) {
197205 if ( line .indexOf (BEG_STRING_PUBLIC ) != -1 ) {
198206 try {
@@ -573,9 +581,17 @@ public static CMSSignedData readPKCS7(Reader in, char[] f) throws IOException {
573581 return null ;
574582 }
575583
576- public static X509AuxCertificate readX509Certificate (final Reader in , final char [] passwd )
584+ /**
585+ * @deprecated Prefer passing in a buffered-reader esp. in loops as the
586+ * method might return a X.509 object before reading the full PEM file !
587+ */
588+ public static X509AuxCertificate readX509Certificate (final Reader in , final char [] passwd ) throws IOException {
589+ return readX509Certificate (makeBuffered (in ), passwd );
590+ }
591+
592+ public static X509AuxCertificate readX509Certificate (final BufferedReader reader , final char [] passwd )
577593 throws IOException {
578- final BufferedReader reader = makeBuffered ( in ); String line ;
594+ String line ;
579595 while ( ( line = reader .readLine () ) != null ) {
580596 if ( line .indexOf (BEG_STRING_X509_OLD ) != -1 ) {
581597 try {
@@ -605,9 +621,17 @@ else if ( line.indexOf(BEG_STRING_X509_TRUSTED) != -1 ) {
605621 return null ;
606622 }
607623
608- public static X509AuxCertificate readX509Aux (final Reader in , final char [] passwd )
624+ /**
625+ * @deprecated Prefer passing in a buffered-reader esp. in loops as the
626+ * method might return a X.509 object before reading the full PEM file !
627+ */
628+ public static X509AuxCertificate readX509Aux (final Reader in , final char [] passwd ) throws IOException {
629+ return readX509Aux (makeBuffered (in ), passwd );
630+ }
631+
632+ public static X509AuxCertificate readX509Aux (final BufferedReader reader , final char [] passwd )
609633 throws IOException {
610- final BufferedReader reader = makeBuffered ( in ); String line ;
634+ String line ;
611635 while ( ( line = reader .readLine () ) != null ) {
612636 if ( line .indexOf (BEG_STRING_X509_OLD ) != -1 ) {
613637 try {
@@ -637,8 +661,16 @@ else if ( line.indexOf(BEG_STRING_X509_TRUSTED) != -1 ) {
637661 return null ;
638662 }
639663
640- public static X509CRL readX509CRL (final Reader in , final char [] passwd ) throws IOException {
641- final BufferedReader reader = makeBuffered (in ); String line ;
664+ /**
665+ * @deprecated Prefer passing in a buffered-reader esp. in loops as the
666+ * method might return a X.509 object before reading the full PEM file !
667+ */
668+ public static X509CRL readX509CRL (final Reader reader , final char [] passwd ) throws IOException {
669+ return readX509CRL (makeBuffered (reader ), passwd );
670+ }
671+
672+ public static X509CRL readX509CRL (final BufferedReader reader , final char [] passwd ) throws IOException {
673+ String line ;
642674 while ( ( line = reader .readLine () ) != null ) {
643675 if ( line .indexOf (BEG_STRING_X509_CRL ) != -1 ) {
644676 try {
0 commit comments