Add query parameter to WKD URLs
This change adds the l=LOCAL-PART query parameter to WKD URLs as specified in RFC Draft: draft-koch-openpgp-webkey-service-09 section 3.1 since version 07.
This commit is contained in:
@@ -2,8 +2,10 @@ package org.sufficientlysecure.keychain.util;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -50,13 +52,15 @@ public class WebKeyDirectoryUtil {
|
||||
|
||||
if(wkdMethodAdvanced) {
|
||||
// Advanced method
|
||||
return new URL("https://openpgpkey." + domain + "/.well-known/openpgpkey/" + domain + "/hu/" + encodedPart);
|
||||
return new URL("https://openpgpkey." + domain + "/.well-known/openpgpkey/" + domain + "/hu/" + encodedPart + "?l=" + URLEncoder.encode(localPart, "UTF-8"));
|
||||
}else{
|
||||
// Direct method
|
||||
return new URL("https://" + domain + "/.well-known/openpgpkey/hu/" + encodedPart);
|
||||
return new URL("https://" + domain + "/.well-known/openpgpkey/hu/" + encodedPart + "?l=" + URLEncoder.encode(localPart, "UTF-8"));
|
||||
}
|
||||
} catch (MalformedURLException e) {
|
||||
return null;
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user