mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-29 13:24:52 +02:00
Validate BIMI certificates
This commit is contained in:
@@ -79,6 +79,8 @@ public class EntityCertificate {
|
||||
@NonNull
|
||||
public String data;
|
||||
|
||||
static final String OID_BrandIndicatorforMessageIdentification = "1.3.6.1.5.5.7.3.31";
|
||||
|
||||
static EntityCertificate from(X509Certificate certificate, String email) throws CertificateEncodingException, NoSuchAlgorithmException {
|
||||
return from(certificate, false, email);
|
||||
}
|
||||
@@ -167,6 +169,21 @@ public class EntityCertificate {
|
||||
return result;
|
||||
}
|
||||
|
||||
static List<String> getDnsNames(X509Certificate certificate) throws CertificateParsingException {
|
||||
List<String> result = new ArrayList<>();
|
||||
|
||||
Collection<List<?>> altNames = certificate.getSubjectAlternativeNames();
|
||||
if (altNames == null)
|
||||
return result;
|
||||
|
||||
for (List altName : altNames)
|
||||
if (altName.get(0).equals(GeneralName.dNSName))
|
||||
result.add((String) altName.get(1));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public JSONObject toJSON() throws JSONException {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("id", id);
|
||||
|
||||
Reference in New Issue
Block a user