Skip to content

Commit e4e6787

Browse files
committed
code cleanup (imports,javadoc,header)
1 parent 00f7ba5 commit e4e6787

File tree

84 files changed

+63
-233
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+63
-233
lines changed

src/main/java/org/kopi/ebics/certificate/CertificateManager.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* License along with this library; if not, write to the Free Software
1515
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1616
*
17-
* $Id$
1817
*/
1918

2019
package org.kopi.ebics.certificate;
@@ -39,7 +38,6 @@
3938
/**
4039
* Simple manager for EBICS certificates.
4140
*
42-
* @author hacheni
4341
*
4442
*/
4543
public class CertificateManager {

src/main/java/org/kopi/ebics/certificate/KeyStoreManager.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* License along with this library; if not, write to the Free Software
1515
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1616
*
17-
* $Id$
1817
*/
1918

2019
package org.kopi.ebics.certificate;
@@ -50,7 +49,6 @@
5049
* for a given alias.
5150
* The PKCS12 key store type is recommended to be used
5251
*
53-
* @author hachani
5452
*
5553
*/
5654
public class KeyStoreManager {

src/main/java/org/kopi/ebics/certificate/KeyUtil.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414
* License along with this library; if not, write to the Free Software
1515
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1616
*
17-
* $Id$
1817
*/
1918

2019
package org.kopi.ebics.certificate;
2120

22-
import java.io.UnsupportedEncodingException;
2321
import java.nio.charset.StandardCharsets;
2422
import java.security.GeneralSecurityException;
2523
import java.security.KeyPair;
@@ -29,18 +27,16 @@
2927
import java.security.SecureRandom;
3028
import java.security.interfaces.RSAPublicKey;
3129

32-
import org.apache.commons.codec.binary.Base64;
3330
import org.apache.commons.codec.binary.Hex;
3431
import org.kopi.ebics.exception.EbicsException;
3532
import org.kopi.ebics.utils.Utils;
3633

3734
/**
3835
* Some key utilities
3936
*
40-
* @author hachani
4137
*
4238
*/
43-
public class KeyUtil {
39+
public final class KeyUtil {
4440

4541
private KeyUtil() {
4642
}

src/main/java/org/kopi/ebics/certificate/X509Constants.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,23 @@
1414
* License along with this library; if not, write to the Free Software
1515
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1616
*
17-
* $Id$
1817
*/
1918

2019
package org.kopi.ebics.certificate;
2120

2221
/**
2322
* X509 certificate constants
2423
*
25-
* @author hachani
2624
*
2725
*/
2826
public interface X509Constants {
2927

3028
/**
3129
* Certificates key usage
3230
*/
33-
int SIGNATURE_KEY_USAGE = 1;
34-
int AUTHENTICATION_KEY_USAGE = 2;
35-
int ENCRYPTION_KEY_USAGE = 3;
31+
enum CertificateKeyUsage {
32+
SIGNATURE_KEY_USAGE, AUTHENTICATION_KEY_USAGE, ENCRYPTION_KEY_USAGE,
33+
}
3634

3735
/**
3836
* Certificate signature algorithm

src/main/java/org/kopi/ebics/certificate/X509Generator.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@
1414
* License along with this library; if not, write to the Free Software
1515
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1616
*
17-
* $Id$
1817
*/
1918

2019
package org.kopi.ebics.certificate;
2120

22-
import java.io.ByteArrayInputStream;
2321
import java.io.IOException;
24-
import java.io.InputStream;
2522
import java.math.BigInteger;
2623
import java.security.GeneralSecurityException;
2724
import java.security.KeyPair;
@@ -31,10 +28,6 @@
3128
import java.util.Date;
3229
import java.util.TimeZone;
3330

34-
import org.bouncycastle.asn1.ASN1EncodableVector;
35-
import org.bouncycastle.asn1.ASN1InputStream;
36-
import org.bouncycastle.asn1.ASN1Sequence;
37-
import org.bouncycastle.asn1.DERSequence;
3831
import org.bouncycastle.asn1.x500.X500Name;
3932
import org.bouncycastle.asn1.x509.AuthorityKeyIdentifier;
4033
import org.bouncycastle.asn1.x509.BasicConstraints;
@@ -46,16 +39,15 @@
4639
import org.bouncycastle.asn1.x509.SubjectKeyIdentifier;
4740
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
4841
import org.bouncycastle.asn1.x509.X509Extensions;
49-
import org.bouncycastle.asn1.x509.X509Name;
5042
import org.bouncycastle.jce.X509Principal;
5143
import org.bouncycastle.x509.X509V3CertificateGenerator;
44+
import org.kopi.ebics.certificate.X509Constants.CertificateKeyUsage;
5245
import org.kopi.ebics.utils.Utils;
5346

5447
/**
5548
* An X509 certificate generator for EBICS protocol.
5649
* Generated certificates are self signed certificates.
5750
*
58-
* @author hachani
5951
*
6052
*/
6153
@SuppressWarnings("deprecation")
@@ -81,7 +73,7 @@ public X509Certificate generateA005Certificate(KeyPair keypair,
8173
issuer,
8274
notBefore,
8375
notAfter,
84-
X509Constants.SIGNATURE_KEY_USAGE);
76+
CertificateKeyUsage.SIGNATURE_KEY_USAGE);
8577
}
8678

8779
/**
@@ -104,7 +96,7 @@ public X509Certificate generateX002Certificate(KeyPair keypair,
10496
issuer,
10597
notBefore,
10698
notAfter,
107-
X509Constants.AUTHENTICATION_KEY_USAGE);
99+
CertificateKeyUsage.AUTHENTICATION_KEY_USAGE);
108100
}
109101

110102
/**
@@ -127,7 +119,7 @@ public X509Certificate generateE002Certificate(KeyPair keypair,
127119
issuer,
128120
notBefore,
129121
notAfter,
130-
X509Constants.ENCRYPTION_KEY_USAGE);
122+
CertificateKeyUsage.ENCRYPTION_KEY_USAGE);
131123
}
132124

133125
/**
@@ -146,14 +138,15 @@ public X509Certificate generate(KeyPair keypair,
146138
String issuer,
147139
Date notBefore,
148140
Date notAfter,
149-
int keyusage)
141+
CertificateKeyUsage keyusage)
150142
throws GeneralSecurityException, IOException
151143
{
152144
X509V3CertificateGenerator generator;
153145
BigInteger serial;
154146
X509Certificate certificate;
155147

156148
serial = BigInteger.valueOf(generateSerial());
149+
157150
generator = new X509V3CertificateGenerator();
158151
generator.setSerialNumber(serial);
159152
generator.setIssuerDN(new X509Principal(issuer));
@@ -180,13 +173,13 @@ public X509Certificate generate(KeyPair keypair,
180173
generator.addExtension(X509Extensions.ExtendedKeyUsage, false, new ExtendedKeyUsage(purposeIds));
181174

182175
switch (keyusage) {
183-
case X509Constants.SIGNATURE_KEY_USAGE:
176+
case SIGNATURE_KEY_USAGE:
184177
generator.addExtension(X509Extensions.KeyUsage, false, new KeyUsage(KeyUsage.nonRepudiation));
185178
break;
186-
case X509Constants.AUTHENTICATION_KEY_USAGE:
179+
case AUTHENTICATION_KEY_USAGE:
187180
generator.addExtension(X509Extensions.KeyUsage, false, new KeyUsage(KeyUsage.digitalSignature));
188181
break;
189-
case X509Constants.ENCRYPTION_KEY_USAGE:
182+
case ENCRYPTION_KEY_USAGE:
190183
generator.addExtension(X509Extensions.KeyUsage, false, new KeyUsage(KeyUsage.keyAgreement));
191184
break;
192185
default:

src/main/java/org/kopi/ebics/client/Bank.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* License along with this library; if not, write to the Free Software
1515
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1616
*
17-
* $Id$
1817
*/
1918

2019
package org.kopi.ebics.client;
@@ -34,7 +33,6 @@
3433
* This object is serializable to facilitate persisting of the values.
3534
* Save the object whenever it needs to be saved.
3635
*
37-
* @author Hachani
3836
*
3937
*/
4038
public class Bank implements EbicsBank, Savable {

src/main/java/org/kopi/ebics/client/EbicsClient.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* License along with this library; if not, write to the Free Software
1515
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1616
*
17-
* $Id$
1817
*/
1918

2019
package org.kopi.ebics.client;
@@ -26,6 +25,7 @@
2625
import java.io.ObjectInputStream;
2726
import java.net.URL;
2827
import java.security.GeneralSecurityException;
28+
import java.security.Security;
2929
import java.util.Date;
3030
import java.util.HashMap;
3131
import java.util.List;
@@ -40,6 +40,7 @@
4040
import org.apache.commons.cli.Options;
4141
import org.apache.commons.cli.ParseException;
4242
import org.apache.commons.cli.help.HelpFormatter;
43+
import org.apache.xml.security.Init;
4344
import org.bouncycastle.jce.provider.BouncyCastleProvider;
4445
import org.kopi.ebics.exception.EbicsException;
4546
import org.kopi.ebics.exception.NoDownloadDataAvailableException;
@@ -83,8 +84,8 @@ private static File getRootDir() {
8384
private User defaultUser;
8485

8586
static {
86-
org.apache.xml.security.Init.init();
87-
java.security.Security.addProvider(new BouncyCastleProvider());
87+
Init.init();
88+
Security.addProvider(new BouncyCastleProvider());
8889
}
8990

9091
/**
@@ -513,7 +514,7 @@ private static CommandLine parseArguments(Options options, String[] args)
513514
if (line.hasOption("help")) {
514515
HelpFormatter formatter = HelpFormatter.builder().get();
515516
System.out.println();
516-
formatter.printHelp(EbicsClient.class.getSimpleName(), "",options, "", true);
517+
formatter.printHelp(EbicsClient.class.getSimpleName(), "", options, "", true);
517518
System.out.println();
518519
System.exit(0);
519520
}
@@ -591,7 +592,7 @@ public static void main(String[] args) throws Exception {
591592
addOption(options, OrderType.HPB, "Send HPB request");
592593
options.addOption(null, "letters", false, "Create INI Letters");
593594
options.addOption(null, "create", false, "Create and initialize EBICS user");
594-
addOption(options, OrderType.STA,"Fetch STA file (MT940 file)");
595+
addOption(options, OrderType.STA, "Fetch STA file (MT940 file)");
595596
addOption(options, OrderType.VMK, "Fetch VMK file (MT942 file)");
596597
addOption(options, OrderType.C52, "Fetch camt.052 file");
597598
addOption(options, OrderType.C53, "Fetch camt.053 file");

src/main/java/org/kopi/ebics/client/FileTransfer.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* License along with this library; if not, write to the Free Software
1515
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1616
*
17-
* $Id$
1817
*/
1918

2019
package org.kopi.ebics.client;
@@ -73,7 +72,6 @@
7372
* asymmetrical encryption takes place with the public encryption key of the non-technical
7473
* subscriber, i.e. the submitter of the order.
7574
*
76-
* @author Hachani
7775
*
7876
*/
7977
public class FileTransfer {

src/main/java/org/kopi/ebics/client/HttpRequestSender.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* License along with this library; if not, write to the Free Software
1515
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1616
*
17-
* $Id$
1817
*/
1918

2019
package org.kopi.ebics.client;

src/main/java/org/kopi/ebics/client/KeyManagement.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* License along with this library; if not, write to the Free Software
1515
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1616
*
17-
* $Id$
1817
*/
1918

2019
package org.kopi.ebics.client;
@@ -48,7 +47,6 @@
4847
* Then wait until the bank activated your keys.
4948
* If you are migrating from FTAM. Just send HPB, your EBICS account should be usable without delay.
5049
*
51-
* @author Hachani
5250
*
5351
*/
5452
public class KeyManagement {

0 commit comments

Comments
 (0)