use of org.apache.qpid.server.configuration.IllegalConfigurationException in project qpid-broker-j by apache.
the class NonJavaKeyStoreImpl method validateKeyStoreAttributes.
private void validateKeyStoreAttributes(NonJavaKeyStore<?> keyStore) {
try {
SSLUtil.readPrivateKey(getUrlFromString(keyStore.getPrivateKeyUrl()));
SSLUtil.readCertificates(getUrlFromString(keyStore.getCertificateUrl()));
if (keyStore.getIntermediateCertificateUrl() != null) {
SSLUtil.readCertificates(getUrlFromString(keyStore.getIntermediateCertificateUrl()));
}
} catch (IOException | GeneralSecurityException e) {
throw new IllegalConfigurationException("Cannot validate private key or certificate(s):" + e, e);
}
}
use of org.apache.qpid.server.configuration.IllegalConfigurationException in project qpid-broker-j by apache.
the class NonJavaTrustStoreImpl method updateTrustManagers.
@SuppressWarnings("unused")
private void updateTrustManagers() {
try {
if (_certificatesUrl != null) {
X509Certificate[] certs = SSLUtil.readCertificates(getUrlFromString(_certificatesUrl));
java.security.KeyStore inMemoryKeyStore = java.security.KeyStore.getInstance(java.security.KeyStore.getDefaultType());
inMemoryKeyStore.load(null, null);
int i = 1;
for (Certificate cert : certs) {
inMemoryKeyStore.setCertificateEntry(String.valueOf(i++), cert);
}
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(inMemoryKeyStore);
_trustManagers = tmf.getTrustManagers();
_certificates = certs;
}
} catch (IOException | GeneralSecurityException e) {
throw new IllegalConfigurationException("Cannot load certificate(s) :" + e, e);
}
}
use of org.apache.qpid.server.configuration.IllegalConfigurationException in project qpid-broker-j by apache.
the class SiteSpecificTrustStoreImpl method generateTrustManagers.
private void generateTrustManagers() {
try {
java.security.KeyStore inMemoryKeyStore = java.security.KeyStore.getInstance(java.security.KeyStore.getDefaultType());
inMemoryKeyStore.load(null, null);
inMemoryKeyStore.setCertificateEntry("1", _x509Certificate);
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(inMemoryKeyStore);
_trustManagers = tmf.getTrustManagers();
} catch (IOException | GeneralSecurityException e) {
throw new IllegalConfigurationException("Cannot load certificate(s) :" + e, e);
}
}
use of org.apache.qpid.server.configuration.IllegalConfigurationException in project qpid-broker-j by apache.
the class ManagementModeStoreHandler method remove.
@Override
public synchronized UUID[] remove(final ConfiguredObjectRecord... records) {
assertState(StoreState.OPEN);
synchronized (_store) {
UUID[] idsToRemove = new UUID[records.length];
for (int i = 0; i < records.length; i++) {
idsToRemove[i] = records[i].getId();
}
for (UUID id : idsToRemove) {
if (_cliEntries.containsKey(id)) {
throw new IllegalConfigurationException("Cannot change configuration for command line entry:" + _cliEntries.get(id));
}
}
UUID[] result = _store.remove(records);
for (UUID id : idsToRemove) {
if (_quiescedEntriesOriginalState.containsKey(id)) {
_quiescedEntriesOriginalState.remove(id);
}
}
for (ConfiguredObjectRecord record : records) {
_records.remove(record.getId());
}
return result;
}
}
use of org.apache.qpid.server.configuration.IllegalConfigurationException in project qpid-broker-j by apache.
the class ManagementModeStoreHandler method update.
@Override
public void update(final boolean createIfNecessary, final ConfiguredObjectRecord... records) throws StoreException {
assertState(StoreState.OPEN);
synchronized (_store) {
Collection<ConfiguredObjectRecord> actualUpdates = new ArrayList<ConfiguredObjectRecord>();
for (ConfiguredObjectRecord record : records) {
if (_cliEntries.containsKey(record.getId())) {
throw new IllegalConfigurationException("Cannot save configuration provided as command line argument:" + record);
} else if (_quiescedEntriesOriginalState.containsKey(record.getId())) {
// save entry with the original state
record = createEntryWithState(record, _quiescedEntriesOriginalState.get(record.getId()));
}
actualUpdates.add(record);
}
_store.update(createIfNecessary, actualUpdates.toArray(new ConfiguredObjectRecord[actualUpdates.size()]));
}
for (ConfiguredObjectRecord record : records) {
_records.put(record.getId(), record);
}
}
Aggregations