View Javadoc
1   package org.kuali.common.jute.enc.openssl;
2   
3   import static com.google.common.base.Charsets.UTF_8;
4   import static com.google.common.io.BaseEncoding.base64;
5   
6   import java.nio.charset.Charset;
7   
8   import org.kuali.common.jute.enc.EncryptionPassword;
9   import org.kuali.common.jute.enc.EncryptionPasswordProvider;
10  import org.kuali.common.jute.enc.Encryptor;
11  import org.kuali.common.jute.enc.openssl.annotation.OpenSSLCharset;
12  import org.kuali.common.jute.enc.openssl.annotation.OpenSSLEncoder;
13  
14  import com.google.common.io.BaseEncoding;
15  import com.google.inject.AbstractModule;
16  
17  public class OpenSSLModule extends AbstractModule {
18  
19      @Override
20      protected void configure() {
21          bind(String.class).annotatedWith(EncryptionPassword.class).toProvider(EncryptionPasswordProvider.class).asEagerSingleton();
22          bind(OpenSSLSaltContext.class).toProvider(OpenSSLSaltContextProvider.class).asEagerSingleton();
23          bind(BaseEncoding.class).annotatedWith(OpenSSLEncoder.class).toInstance(base64());
24          bind(Charset.class).annotatedWith(OpenSSLCharset.class).toInstance(UTF_8);
25          bind(OpenSSLContext.class).toProvider(OpenSSLContext.Builder.class).asEagerSingleton();
26          bind(Encryptor.class).to(OpenSSLEncryptor.class).asEagerSingleton();
27      }
28  }