-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for TLSA certificate rollover
Fixes #31.
- Loading branch information
Showing
2 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
minidns-dnssec/src/main/java/de/measite/minidns/dane/DaneCertificateException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright 2015 the original author or authors | ||
* | ||
* This software is licensed under the Apache License, Version 2.0, | ||
* the GNU Lesser General Public License version 2 or later ("LGPL") | ||
* and the WTFPL. | ||
* You may choose either license to govern your use of this software only | ||
* upon the condition that you accept all of the terms of either | ||
* the Apache License 2.0, the LGPL 2.1+ or the WTFPL. | ||
*/ | ||
package de.measite.minidns.dane; | ||
|
||
import java.security.cert.CertificateException; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import de.measite.minidns.record.TLSA; | ||
|
||
public abstract class DaneCertificateException extends CertificateException { | ||
|
||
/** | ||
* | ||
*/ | ||
private static final long serialVersionUID = 1L; | ||
|
||
protected DaneCertificateException() { | ||
} | ||
|
||
protected DaneCertificateException(String message) { | ||
super(message); | ||
} | ||
|
||
public static class CertificateMismatch extends DaneCertificateException { | ||
|
||
/** | ||
* | ||
*/ | ||
private static final long serialVersionUID = 1L; | ||
|
||
public final TLSA tlsa; | ||
public final byte[] computed; | ||
|
||
public CertificateMismatch(TLSA tlsa, byte[] computed) { | ||
super("The TLSA RR does not match the certificate"); | ||
this.tlsa = tlsa; | ||
this.computed = computed; | ||
} | ||
} | ||
|
||
public static class MultipleCertificateMismatchExceptions extends DaneCertificateException { | ||
|
||
/** | ||
* | ||
*/ | ||
private static final long serialVersionUID = 1L; | ||
|
||
public final List<CertificateMismatch> certificateMismatchExceptions; | ||
|
||
public MultipleCertificateMismatchExceptions(List<CertificateMismatch> certificateMismatchExceptions) { | ||
super("There where multiple CertificateMismatch exceptions because none of the TLSA RR does match the certificate"); | ||
assert !certificateMismatchExceptions.isEmpty(); | ||
this.certificateMismatchExceptions = Collections.unmodifiableList(certificateMismatchExceptions); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters