Search in sources :

Example 1 with RsaEncrypter

use of org.opensmartgridplatform.shared.security.RsaEncrypter in project open-smart-grid-platform by OSGP.

the class SoapClientConfig method encrypterForSecretManagement.

// RsaEncrypter for encrypting secrets to be sent to Secret Management.
@Bean(name = "encrypterForSecretManagement")
public RsaEncrypter encrypterForSecretManagement() {
    try {
        final File publicKeySecretManagementFile = this.rsaPublicKeySecretManagement.getFile();
        final RsaEncrypter rsaEncrypter = new RsaEncrypter();
        rsaEncrypter.setPublicKeyStore(publicKeySecretManagementFile);
        return rsaEncrypter;
    } catch (final IOException e) {
        throw new IllegalStateException("Could not initialize encrypterForSecretManagement", e);
    }
}
Also used : RsaEncrypter(org.opensmartgridplatform.shared.security.RsaEncrypter) IOException(java.io.IOException) File(java.io.File) TrustManagersFactoryBean(org.springframework.ws.soap.security.support.TrustManagersFactoryBean) KeyStoreFactoryBean(org.springframework.ws.soap.security.support.KeyStoreFactoryBean) KeyManagersFactoryBean(org.springframework.ws.soap.security.support.KeyManagersFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with RsaEncrypter

use of org.opensmartgridplatform.shared.security.RsaEncrypter in project open-smart-grid-platform by OSGP.

the class SoapClientConfig method encrypterForGxfSmartMetering.

// RsaEncrypter for encrypting secrets to be sent to other GXF components.
@Bean(name = "encrypterForGxfSmartMetering")
public RsaEncrypter encrypterForGxfSmartMetering() {
    try {
        final File publicKeyGxfSmartMeteringFile = this.rsaPublicKeyGxfSmartMetering.getFile();
        final RsaEncrypter rsaEncrypter = new RsaEncrypter();
        rsaEncrypter.setPublicKeyStore(publicKeyGxfSmartMeteringFile);
        return rsaEncrypter;
    } catch (final IOException e) {
        throw new IllegalStateException("Could not initialize encrypterForGxfSmartMetering", e);
    }
}
Also used : RsaEncrypter(org.opensmartgridplatform.shared.security.RsaEncrypter) IOException(java.io.IOException) File(java.io.File) TrustManagersFactoryBean(org.springframework.ws.soap.security.support.TrustManagersFactoryBean) KeyStoreFactoryBean(org.springframework.ws.soap.security.support.KeyStoreFactoryBean) KeyManagersFactoryBean(org.springframework.ws.soap.security.support.KeyManagersFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 3 with RsaEncrypter

use of org.opensmartgridplatform.shared.security.RsaEncrypter in project open-smart-grid-platform by OSGP.

the class SoapClientConfig method decrypterForProtocolAdapterDlms.

// RsaEncrypter for decrypting secrets from Secret Management received by the DLMS protocol
// adapter.
@Bean(name = "decrypterForProtocolAdapterDlms")
public RsaEncrypter decrypterForProtocolAdapterDlms() {
    try {
        final File privateKeyProtocolAdapterFile = this.rsaPrivateKeyProtocolAdapterDlms.getFile();
        final RsaEncrypter rsaEncrypter = new RsaEncrypter();
        rsaEncrypter.setPrivateKeyStore(privateKeyProtocolAdapterFile);
        return rsaEncrypter;
    } catch (final IOException e) {
        throw new IllegalStateException("Could not initialize decrypterForProtocolAdapterDlms", e);
    }
}
Also used : RsaEncrypter(org.opensmartgridplatform.shared.security.RsaEncrypter) IOException(java.io.IOException) File(java.io.File) TrustManagersFactoryBean(org.springframework.ws.soap.security.support.TrustManagersFactoryBean) KeyStoreFactoryBean(org.springframework.ws.soap.security.support.KeyStoreFactoryBean) KeyManagersFactoryBean(org.springframework.ws.soap.security.support.KeyManagersFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 4 with RsaEncrypter

use of org.opensmartgridplatform.shared.security.RsaEncrypter in project open-smart-grid-platform by OSGP.

the class SecurityConfig method decrypterForGxfSmartMetering.

// RsaEncrypter for decrypting secrets from other GXF components.
@Bean(name = "decrypterForGxfSmartMetering")
public RsaEncrypter decrypterForGxfSmartMetering() {
    try {
        final File privateRsaKeyFile = this.rsaPrivateKeyGxfSmartMetering.getFile();
        final RsaEncrypter rsaEncrypter = new RsaEncrypter();
        rsaEncrypter.setPrivateKeyStore(privateRsaKeyFile);
        return rsaEncrypter;
    } catch (final IOException e) {
        throw new IllegalStateException("Could not initialize decrypterForGxfSmartMetering", e);
    }
}
Also used : RsaEncrypter(org.opensmartgridplatform.shared.security.RsaEncrypter) IOException(java.io.IOException) File(java.io.File) Bean(org.springframework.context.annotation.Bean)

Example 5 with RsaEncrypter

use of org.opensmartgridplatform.shared.security.RsaEncrypter in project open-smart-grid-platform by OSGP.

the class SecurityConfig method encrypterForSecretManagementClient.

// RsaEncrypter for encrypting secrets to be sent to the client of Secret Management.
@Bean(name = "encrypterForSecretManagementClient")
public RsaEncrypter encrypterForSecretManagementClient() {
    try {
        final File publicKeySecretManagementFile = this.rsaPublicKeySecretManagementClient.getFile();
        final RsaEncrypter rsaEncrypter = new RsaEncrypter();
        rsaEncrypter.setPublicKeyStore(publicKeySecretManagementFile);
        return rsaEncrypter;
    } catch (final IOException e) {
        throw new IllegalStateException("Could not initialize encrypterForSecretManagementClient", e);
    }
}
Also used : RsaEncrypter(org.opensmartgridplatform.shared.security.RsaEncrypter) IOException(java.io.IOException) File(java.io.File) Bean(org.springframework.context.annotation.Bean)

Aggregations

IOException (java.io.IOException)8 RsaEncrypter (org.opensmartgridplatform.shared.security.RsaEncrypter)8 File (java.io.File)7 Bean (org.springframework.context.annotation.Bean)7 KeyManagersFactoryBean (org.springframework.ws.soap.security.support.KeyManagersFactoryBean)4 KeyStoreFactoryBean (org.springframework.ws.soap.security.support.KeyStoreFactoryBean)4 TrustManagersFactoryBean (org.springframework.ws.soap.security.support.TrustManagersFactoryBean)4 ApplicationDataLookupKey (org.opensmartgridplatform.adapter.ws.domain.entities.ApplicationDataLookupKey)1 ApplicationKeyConfiguration (org.opensmartgridplatform.adapter.ws.domain.entities.ApplicationKeyConfiguration)1 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)1 FileSystemResource (org.springframework.core.io.FileSystemResource)1 Resource (org.springframework.core.io.Resource)1