Skip to content
This repository has been archived by the owner on Sep 7, 2019. It is now read-only.

Commit

Permalink
Merge commit 'bb6363cfe62bb74a2a5e48bfc6f82feffc7001de' into CONNECT
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins Automation Server committed May 22, 2019
2 parents b182021 + bb6363c commit d38e7cf
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,11 @@ public void validateAndDeleteCertificate() throws CertificateManagerException {
String hashToken = service.getHashToken(trustStorePasskey);
if (deleteCertificate(hashToken)) {
saveHashToken(hashToken);
execPFHideDialog("deletePassKeyDlg");
}
} else {
deleteCertificate(getHashTokenFromSession());
}
execPFHideDialog("deletePassKeyDlg");
trustStorePasskey = null;
}

Expand Down Expand Up @@ -768,6 +768,7 @@ public void cancelImportWizard() {

private void clearImportWizard() {
alias = null;
oldAlias = null;
exchangeType = null;
commonName = null;
organization = null;
Expand All @@ -781,6 +782,7 @@ private void clearImportWizard() {
disableNext = new boolean[] { true, true, true, true, true, true };
enableTab(0);
disableImportAction = true;
refreshCacheForTrustStore();
}

public void next() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@
<li class="list-group-item"><p:commandLink
action="#{certificateBean.resumeImportWizard(1)}"
style="margin-right:20px;" update="@(.cssImportWizard)">
<p:resetInput target="certTabView:importCertTabView:tabIdCreateCert" />
<h:outputText value="Create a new Certificate" />
</p:commandLink></li>
<li class="list-group-item"><p:commandLink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<h4>TrustStore Password</h4>
<div class="form-block center-block">
<h:form id="deletePassKeyDlgForm" class="form form-horizontal">
<p:messages id="deletePassKeyErrorMsg" closable="true" autoUpdate="true" showDetail="true" />
<div class="form-group">
<h:outputLabel for="deletePasskey" class="col-sm-3 control-label" id="inputPassKeyLbl" value="Password:" />
<div class="col-sm-9">
Expand All @@ -22,7 +21,7 @@
<div class="form-group">
<div class="col-sm-12">
<div class="form-button-row">
<p:commandButton id="savePasskey" styleClass="btn btn-primary" value="OK" ajax="true" update=":certTabView:trustStoreForm :deletePassKeyDlgForm" actionListener="#{certificateBean.validateAndDeleteCertificate}" onclick="$(PF('deletePassKeyDlg').hide()"/>
<p:commandButton id="savePasskey" styleClass="btn btn-primary" value="OK" ajax="true" update=":certTabView:trustStoreForm :deletePassKeyDlgForm" actionListener="#{certificateBean.validateAndDeleteCertificate}" onclick="PF('deletePassKeyDlg').hide()"/>
<p:commandButton id="closePassKey" styleClass="btn btn-primary" value="Cancel" onclick="$('#deletePassKeyDlgForm\\:deletePasskey').val('');PF('deletePassKeyDlg').hide()"/>
</div>
</div>
Expand Down
5 changes: 4 additions & 1 deletion Product/Production/Common/CONNECTCoreLib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,10 @@
<version>5.1.10</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,11 @@
import org.apache.commons.lang3.tuple.Pair;
import org.apache.wss4j.common.crypto.DERDecoder;
import org.apache.wss4j.common.ext.WSSecurityException;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.x509.AuthorityKeyIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
*
* @author jassmit
*/
public class CertificateUtil {

private static final Logger LOG = LoggerFactory.getLogger(CertificateUtil.class);
Expand Down Expand Up @@ -165,21 +163,21 @@ public static String getCertKeyIdAuthority(Pair<String, Certificate> pair) {
}
return getCertKeyIdAuthority((X509Certificate) pair.getValue());
}

public static String getCertKeyIdAuthority(Certificate cert) {
return getCertKeyIdAuthority((X509Certificate) cert);
}

public static String getCertKeyIdAuthority(X509Certificate cert) {
String authId = null;
if (null != cert) {
byte[] akiBytes = cert.getExtensionValue(AUTHORITY_KEY_ID);
try {
if (akiBytes != null) {
DERDecoder extValA = new DERDecoder(akiBytes);
extValA.skip(6);
authId = Hex.encodeHexString(extValA.getBytes(20));
}
} catch (WSSecurityException e) {
LOG.error("Unable to decode certificate authority {}", e.getLocalizedMessage(), e);

if (akiBytes != null) {
byte[] octets = DEROctetString.getInstance(akiBytes).getOctets();
AuthorityKeyIdentifier authorityKeyIdentifier = AuthorityKeyIdentifier.getInstance(octets);
byte[] keyIdentifier = authorityKeyIdentifier.getKeyIdentifier();
authId = Hex.encodeHexString(keyIdentifier);
}

String subjId = getCertKeyIdSubject(cert);
Expand All @@ -194,6 +192,7 @@ public static String getCertKeyIdAuthority(X509Certificate cert) {
public static String getCertKeyIdSubject(Certificate cert) {
return getCertKeyIdSubject((X509Certificate) cert);
}

public static String getCertKeyIdSubject(X509Certificate cert) {
String ski = null;
if (null != cert) {
Expand All @@ -219,6 +218,7 @@ public static String getCertKeyIdSubject(X509Certificate cert) {
public static String getCertSubjectCN(Certificate cert) {
return getCertSubjectCN((X509Certificate) cert);
}

public static String getCertSubjectCN(X509Certificate cert) {
if (null == cert) {
return null;
Expand Down

0 comments on commit d38e7cf

Please sign in to comment.