@@ -189,10 +189,18 @@ private static BufferedWriter makeBuffered(Writer out) {
189
189
}
190
190
191
191
/**
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 !
193
194
*/
194
195
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 ;
196
204
while ( ( line = reader .readLine () ) != null ) {
197
205
if ( line .indexOf (BEG_STRING_PUBLIC ) != -1 ) {
198
206
try {
@@ -573,9 +581,17 @@ public static CMSSignedData readPKCS7(Reader in, char[] f) throws IOException {
573
581
return null ;
574
582
}
575
583
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 )
577
593
throws IOException {
578
- final BufferedReader reader = makeBuffered ( in ); String line ;
594
+ String line ;
579
595
while ( ( line = reader .readLine () ) != null ) {
580
596
if ( line .indexOf (BEG_STRING_X509_OLD ) != -1 ) {
581
597
try {
@@ -605,9 +621,17 @@ else if ( line.indexOf(BEG_STRING_X509_TRUSTED) != -1 ) {
605
621
return null ;
606
622
}
607
623
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 )
609
633
throws IOException {
610
- final BufferedReader reader = makeBuffered ( in ); String line ;
634
+ String line ;
611
635
while ( ( line = reader .readLine () ) != null ) {
612
636
if ( line .indexOf (BEG_STRING_X509_OLD ) != -1 ) {
613
637
try {
@@ -637,8 +661,16 @@ else if ( line.indexOf(BEG_STRING_X509_TRUSTED) != -1 ) {
637
661
return null ;
638
662
}
639
663
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 ;
642
674
while ( ( line = reader .readLine () ) != null ) {
643
675
if ( line .indexOf (BEG_STRING_X509_CRL ) != -1 ) {
644
676
try {
0 commit comments