use constants for oids in xmppdomainverifier

This commit is contained in:
Daniel Gultsch 2015-10-15 19:14:41 +02:00
parent 5b271e1ed8
commit fc96dcaa4d
1 changed files with 5 additions and 2 deletions

View File

@ -27,6 +27,9 @@ public class XmppDomainVerifier implements HostnameVerifier {
private final String LOGTAG = "XmppDomainVerifier"; private final String LOGTAG = "XmppDomainVerifier";
private final String SRVName = "1.3.6.1.5.5.7.8.7";
private final String xmppAddr = "1.3.6.1.5.5.7.8.5";
@Override @Override
public boolean verify(String domain, SSLSession sslSession) { public boolean verify(String domain, SSLSession sslSession) {
try { try {
@ -53,14 +56,14 @@ public class XmppDomainVerifier implements HostnameVerifier {
String oid = sequence.getObjectAt(0).toString(); String oid = sequence.getObjectAt(0).toString();
ASN1Primitive value = ((DERTaggedObject) sequence.getObjectAt(1)).getObject(); ASN1Primitive value = ((DERTaggedObject) sequence.getObjectAt(1)).getObject();
switch (oid) { switch (oid) {
case "1.3.6.1.5.5.7.8.5": case xmppAddr:
if (value instanceof DERUTF8String) { if (value instanceof DERUTF8String) {
xmppAddrs.add(((DERUTF8String) value).getString()); xmppAddrs.add(((DERUTF8String) value).getString());
} else if (value instanceof DERIA5String) { } else if (value instanceof DERIA5String) {
xmppAddrs.add(((DERIA5String) value).getString()); xmppAddrs.add(((DERIA5String) value).getString());
} }
break; break;
case "1.3.6.1.5.5.7.8.7": case SRVName:
if (value instanceof DERUTF8String) { if (value instanceof DERUTF8String) {
srvNames.add(((DERUTF8String) value).getString()); srvNames.add(((DERUTF8String) value).getString());
} else if (value instanceof DERIA5String) { } else if (value instanceof DERIA5String) {