290 }
291
292 // throw exception if odd number of hex digits
293 if (cNdx % 2 == 1) {
294 throw new IOException("AVA parse, odd number of hex digits");
295 }
296
297 return new DerValue(baos.toByteArray());
298 }
299
300 private DerValue parseQuotedString
301 (Reader in, StringBuilder temp) throws IOException {
302
303 // RFC1779 specifies that an entire RDN may be enclosed in double
304 // quotes. In this case the syntax is any sequence of
305 // backslash-specialChar, backslash-backslash,
306 // backslash-doublequote, or character other than backslash or
307 // doublequote.
308 int c = readChar(in, "Quoted string did not end in quote");
309
310 List<Byte> embeddedHex = new ArrayList<Byte>();
311 boolean isPrintableString = true;
312 while (c != '"') {
313 if (c == '\\') {
314 c = readChar(in, "Quoted string did not end in quote");
315
316 // check for embedded hex pairs
317 Byte hexByte = null;
318 if ((hexByte = getEmbeddedHexPair(c, in)) != null) {
319
320 // always encode AVAs with embedded hex as UTF8
321 isPrintableString = false;
322
323 // append consecutive embedded hex
324 // as single string later
325 embeddedHex.add(hexByte);
326 c = in.read();
327 continue;
328 }
329
330 if (specialChars1779.indexOf((char)c) < 0) {
|
290 }
291
292 // throw exception if odd number of hex digits
293 if (cNdx % 2 == 1) {
294 throw new IOException("AVA parse, odd number of hex digits");
295 }
296
297 return new DerValue(baos.toByteArray());
298 }
299
300 private DerValue parseQuotedString
301 (Reader in, StringBuilder temp) throws IOException {
302
303 // RFC1779 specifies that an entire RDN may be enclosed in double
304 // quotes. In this case the syntax is any sequence of
305 // backslash-specialChar, backslash-backslash,
306 // backslash-doublequote, or character other than backslash or
307 // doublequote.
308 int c = readChar(in, "Quoted string did not end in quote");
309
310 List<Byte> embeddedHex = new ArrayList<>();
311 boolean isPrintableString = true;
312 while (c != '"') {
313 if (c == '\\') {
314 c = readChar(in, "Quoted string did not end in quote");
315
316 // check for embedded hex pairs
317 Byte hexByte = null;
318 if ((hexByte = getEmbeddedHexPair(c, in)) != null) {
319
320 // always encode AVAs with embedded hex as UTF8
321 isPrintableString = false;
322
323 // append consecutive embedded hex
324 // as single string later
325 embeddedHex.add(hexByte);
326 c = in.read();
327 continue;
328 }
329
330 if (specialChars1779.indexOf((char)c) < 0) {
|