use of org.opensmartgridplatform.shared.security.RsaEncrypter in project open-smart-grid-platform by OSGP.
the class SecurityConfig method decrypterForSecretManagement.
// RsaEncrypter for decrypting secrets received by Secret Management.
@Bean(name = "decrypterForSecretManagement")
public RsaEncrypter decrypterForSecretManagement() {
try {
final File privateKeySecretManagementFile = this.rsaPrivateKeySecretManagement.getFile();
final RsaEncrypter rsaEncrypter = new RsaEncrypter();
rsaEncrypter.setPrivateKeyStore(privateKeySecretManagementFile);
return rsaEncrypter;
} catch (final IOException e) {
throw new IllegalStateException("Could not initialize decrypterForSecretManagement", e);
}
}
use of org.opensmartgridplatform.shared.security.RsaEncrypter in project open-smart-grid-platform by OSGP.
the class SmartMeteringConfigurationEndpoint method getRsaEncrypterForApplication.
private RsaEncrypter getRsaEncrypterForApplication(final String organisationIdentification) throws OsgpException {
final ApplicationKeyConfiguration applicationKeyConfiguration = this.applicationKeyConfigurationRepository.findById(new ApplicationDataLookupKey(organisationIdentification, this.webserviceNotificationApplicationName)).orElseThrow(() -> new OsgpException(ComponentType.WS_SMART_METERING, "No public key found for application " + this.webserviceNotificationApplicationName + " and organisation " + organisationIdentification));
final String publicKeyLocation = applicationKeyConfiguration.getPublicKeyLocation();
try {
final Resource keyResource = new FileSystemResource(publicKeyLocation);
final RsaEncrypter applicationRsaEncrypter = new RsaEncrypter();
applicationRsaEncrypter.setPublicKeyStore(keyResource.getFile());
return applicationRsaEncrypter;
} catch (final IOException e) {
throw new OsgpException(ComponentType.WS_SMART_METERING, "Could not get public key file for application " + this.webserviceNotificationApplicationName + " and organisation " + organisationIdentification);
}
}
use of org.opensmartgridplatform.shared.security.RsaEncrypter in project open-smart-grid-platform by OSGP.
the class SoapClientConfig method decrypterForGxfSmartMetering.
// RsaEncrypter for decrypting secrets from applications received by the DLMS protocol adapter.
@Bean(name = "decrypterForGxfSmartMetering")
public RsaEncrypter decrypterForGxfSmartMetering() {
try {
final File privateKeyGxfSmartMeteringFile = this.rsaPrivateKeyGxfSmartMetering.getFile();
final RsaEncrypter rsaEncrypter = new RsaEncrypter();
rsaEncrypter.setPrivateKeyStore(privateKeyGxfSmartMeteringFile);
return rsaEncrypter;
} catch (final IOException e) {
throw new IllegalStateException("Could not initialize decrypterForGxfSmartMetering", e);
}
}
Aggregations