mirror of
https://codeberg.org/PGPainless/cert-d-java.git
synced 2024-11-22 15:32:09 +01:00
Throw BadDataException when reading certificate
This commit is contained in:
parent
0846528072
commit
1b63a4ac9a
2 changed files with 6 additions and 3 deletions
|
@ -97,7 +97,7 @@ public class SharedPGPCertificateDirectoryImpl implements SharedPGPCertificateDi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Certificate getBySpecialName(String specialName)
|
public Certificate getBySpecialName(String specialName)
|
||||||
throws IOException, BadNameException {
|
throws IOException, BadNameException, BadDataException {
|
||||||
File certFile = resolver.getCertFileBySpecialName(specialName);
|
File certFile = resolver.getCertFileBySpecialName(specialName);
|
||||||
if (!certFile.exists()) {
|
if (!certFile.exists()) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -122,7 +122,7 @@ public class SharedPGPCertificateDirectoryImpl implements SharedPGPCertificateDi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Certificate getBySpecialNameIfChanged(String specialName, String tag)
|
public Certificate getBySpecialNameIfChanged(String specialName, String tag)
|
||||||
throws IOException, BadNameException {
|
throws IOException, BadNameException, BadDataException {
|
||||||
Certificate certificate = getBySpecialName(specialName);
|
Certificate certificate = getBySpecialName(specialName);
|
||||||
if (certificate.getTag().equals(tag)) {
|
if (certificate.getTag().equals(tag)) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
package pgp.certificate_store;
|
package pgp.certificate_store;
|
||||||
|
|
||||||
|
import pgp.certificate_store.exception.BadDataException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
@ -20,7 +22,8 @@ public interface CertificateReaderBackend {
|
||||||
* @return certificate object
|
* @return certificate object
|
||||||
*
|
*
|
||||||
* @throws IOException in case of an IO error
|
* @throws IOException in case of an IO error
|
||||||
|
* @throws BadDataException in case that the input stream does not contain OpenPGP certificate data
|
||||||
*/
|
*/
|
||||||
Certificate readCertificate(InputStream inputStream) throws IOException;
|
Certificate readCertificate(InputStream inputStream) throws IOException, BadDataException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue