This discussion is archived
3 Replies Latest reply: Feb 26, 2013 6:26 AM by 805574 RSS

How to add the backslash to the subject

992372 Newbie
Currently Being Moderated
X500Principal p = new X500Principal("cn=test\xyzi");

I get this error
Exception in thread "main" java.lang.IllegalArgumentException: improperly specified input name: cn=test\xyz
     at javax.security.auth.x500.X500Principal.<init>(X500Principal.java:150)
     at javax.security.auth.x500.X500Principal.<init>(X500Principal.java:102)
     at Test.main(Test.java:26)
Caused by: java.io.IOException: Invalid escaped character in AVA: 'v'
     at sun.security.x509.AVA.parseString(AVA.java:405)
     at sun.security.x509.AVA.<init>(AVA.java:207)
     at sun.security.x509.AVA.<init>(AVA.java:128)
     at sun.security.x509.RDN.<init>(RDN.java:134)
     at sun.security.x509.X500Name.parseDN(X500Name.java:918)
     at sun.security.x509.X500Name.<init>(X500Name.java:148)
     at javax.security.auth.x500.X500Principal.<init>(X500Principal.java:148)



If I do this
X500Name name = new X500Name("cn=test\xyz");
System.out.println(name.toString());

then I get testxyz It removes the escape chars

Edited by: 989369 on Feb 20, 2013 9:29 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points