clean up module info
This commit is contained in:
parent
cdc4639347
commit
3049d51e96
7 changed files with 46 additions and 50 deletions
|
@ -22,10 +22,11 @@ jar {
|
|||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.compilerArgs.add('-Xlint:all,-exports')
|
||||
options.compilerArgs.add('-Xlint:all')
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
javadoc {
|
||||
tasks.withType(Javadoc) {
|
||||
options.addStringOption('Xdoclint:none', '-quiet')
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import org.xbib.net.security.CertificateProvider;
|
|||
import org.xbib.net.bouncycastle.BouncyCastleCertificateProvider;
|
||||
|
||||
module org.xbib.net.bouncycastle {
|
||||
requires org.xbib.net.security;
|
||||
requires transitive org.xbib.net.security;
|
||||
requires org.bouncycastle.pkix;
|
||||
requires org.bouncycastle.provider;
|
||||
exports org.xbib.net.bouncycastle;
|
||||
|
|
|
@ -5,7 +5,6 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
|||
import org.bouncycastle.openssl.PEMKeyPair;
|
||||
import org.bouncycastle.openssl.PEMParser;
|
||||
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
|
||||
import org.bouncycastle.operator.OperatorCreationException;
|
||||
import org.xbib.net.security.CertificateProvider;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -13,8 +12,6 @@ import java.io.InputStream;
|
|||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.KeyPair;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.NoSuchProviderException;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.Provider;
|
||||
import java.security.SecureRandom;
|
||||
|
@ -55,12 +52,8 @@ public class BouncyCastleCertificateProvider implements CertificateProvider {
|
|||
|
||||
@Override
|
||||
public Map.Entry<PrivateKey, Collection<? extends X509Certificate>> provideSelfSigned(String fullQualifiedDomainName) throws CertificateException, IOException {
|
||||
try {
|
||||
SelfSignedCertificate selfSignedCertificate = new SelfSignedCertificate();
|
||||
selfSignedCertificate.generate(fullQualifiedDomainName, secureRandom, 2048);
|
||||
return Map.entry(selfSignedCertificate.getPrivateKey(), List.of(selfSignedCertificate.getCertificate()));
|
||||
} catch (NoSuchProviderException | NoSuchAlgorithmException | OperatorCreationException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,13 +70,11 @@ public final class SelfSignedCertificate {
|
|||
* @param fqdn a fully qualified domain name
|
||||
* @param random the {@link SecureRandom} to use
|
||||
* @param bits the number of bits of the generated private key
|
||||
* @throws NoSuchAlgorithmException if algorithm does not exist
|
||||
* @throws NoSuchProviderException if provider does not exist
|
||||
* @throws OperatorCreationException if provider does not exist
|
||||
* @throws IOException if generation fails
|
||||
*/
|
||||
public void generate(String fqdn, SecureRandom random, int bits)
|
||||
throws IOException, NoSuchProviderException, NoSuchAlgorithmException, OperatorCreationException {
|
||||
throws IOException {
|
||||
try {
|
||||
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA", "BC");
|
||||
keyGen.initialize(bits, random);
|
||||
KeyPair keypair = keyGen.generateKeyPair();
|
||||
|
@ -108,6 +106,9 @@ public final class SelfSignedCertificate {
|
|||
outputStream.write(END_CERT.getBytes(StandardCharsets.US_ASCII));
|
||||
outputStream.write('\n');
|
||||
this.certBytes = outputStream.toByteArray();
|
||||
} catch (NoSuchProviderException | NoSuchAlgorithmException | OperatorCreationException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,5 +11,6 @@ module org.xbib.net.security {
|
|||
exports org.xbib.net.security.eddsa.spec;
|
||||
exports org.xbib.net.security.signatures;
|
||||
exports org.xbib.net.security.ssl;
|
||||
exports org.xbib.net.security.ssl.trustmanager;
|
||||
exports org.xbib.net.security.util;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module org.xbib.net.socket {
|
||||
requires java.logging;
|
||||
requires com.sun.jna;
|
||||
requires transitive com.sun.jna;
|
||||
exports org.xbib.net.socket;
|
||||
exports org.xbib.net.socket.v4;
|
||||
exports org.xbib.net.socket.v4.bsd;
|
||||
|
|
|
@ -15,7 +15,7 @@ module org.xbib.net {
|
|||
exports org.xbib.net.util;
|
||||
requires transitive org.xbib.datastructures.common;
|
||||
requires java.management;
|
||||
requires java.logging;
|
||||
requires transitive java.logging;
|
||||
uses DataBufferFactory;
|
||||
provides DataBufferFactory with DefaultDataBufferFactory;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue