Skip to content

Commit

Permalink
Fix export order
Browse files Browse the repository at this point in the history
  • Loading branch information
hdecarne committed Apr 1, 2018
1 parent 828c607 commit 1f13595
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/main/java/de/carne/certmgr/certs/io/JKSCertReaderWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.List;

import de.carne.certmgr.certs.CertObjectStore;
import de.carne.certmgr.certs.CertObjectType;
import de.carne.certmgr.certs.CertProviderException;
import de.carne.certmgr.certs.PasswordCallback;
import de.carne.certmgr.certs.PasswordRequiredException;
Expand Down Expand Up @@ -124,20 +125,16 @@ public void writeEncryptedBinary(IOResource<OutputStream> out, CertObjectStore c
List<X509Certificate> crtChain = new ArrayList<>(certObjects.size());

for (CertObjectStore.Entry certObject : certObjects) {
switch (certObject.type()) {
case CRT:
if (certObject.type() == CertObjectType.CRT) {
keyStore.setCertificateEntry(certObject.alias(), certObject.getCRT());
crtChain.add(certObject.getCRT());
break;
case KEY:
crtChain.add(0, certObject.getCRT());
}
}
for (CertObjectStore.Entry certObject : certObjects) {
if (certObject.type() == CertObjectType.KEY) {
keyStore.setKeyEntry(certObject.alias(), certObject.getKey().getPrivate(), passwordChars,
crtChain.toArray(new X509Certificate[crtChain.size()]));
crtChain.clear();
break;
case CSR:
break;
case CRL:
break;
}
}
keyStore.store(out.io(), passwordChars);
Expand Down

0 comments on commit 1f13595

Please sign in to comment.