Package org.jclouds.crypto

Examples of org.jclouds.crypto.Crypto


      openSshKey = SshKeys.encodeAsOpenSSH(RSAPublicKey.class.cast(publicKey));
   }

   @Test
   public void testApply() {
      final Crypto crypto = createMock(Crypto.class);
      KeyPairGenerator rsaKeyPairGenerator = createMock(KeyPairGenerator.class);
      final SecureRandom secureRandom = createMock(SecureRandom.class);

      expect(crypto.rsaKeyPairGenerator()).andReturn(rsaKeyPairGenerator);
      rsaKeyPairGenerator.initialize(2048, secureRandom);
      expect(rsaKeyPairGenerator.genKeyPair()).andReturn(keyPair);

      replay(crypto, rsaKeyPairGenerator, secureRandom);
View Full Code Here


public class BouncyCastleCryptoTest  {

   @BeforeTest
   protected void createCrypto() {
      Injector i = Guice.createInjector(new BouncyCastleCryptoModule());
      Crypto crypto = i.getInstance(Crypto.class);
      assert crypto instanceof BouncyCastleCrypto;
   }
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testDecryptStringWithBouncyCastle() throws Exception {
    Crypto crypto = new BouncyCastleCrypto();
    decryptAndVerify(crypto);

  }
View Full Code Here

   *
   * @throws Exception .
   */
  @Test
  public void testDecryptStringWithJCE() throws Exception {
    Crypto crypto = new JCECrypto();
    decryptAndVerify(crypto);

  }
View Full Code Here

               PrivateKey privateKey = keyfactory.generatePrivate(privateKeySpec(ByteSource.wrap(
                       PRIVATE_KEY.getBytes(UTF_8))));
               PublicKey publicKey = keyfactory.generatePublic(publicKeySpec(ByteSource.wrap(PUBLIC_KEY.getBytes(UTF_8))));
               KeyPair keyPair = new KeyPair(publicKey, privateKey);
               openSshKey = SshKeys.encodeAsOpenSSH(RSAPublicKey.class.cast(publicKey));
               final Crypto crypto = createMock(Crypto.class);
               KeyPairGenerator rsaKeyPairGenerator = createMock(KeyPairGenerator.class);
               final SecureRandom secureRandom = createMock(SecureRandom.class);
               expect(crypto.rsaKeyPairGenerator()).andReturn(rsaKeyPairGenerator).anyTimes();
               rsaKeyPairGenerator.initialize(2048, secureRandom);
               expectLastCall().anyTimes();
               expect(rsaKeyPairGenerator.genKeyPair()).andReturn(keyPair).anyTimes();
               replay(crypto, rsaKeyPairGenerator, secureRandom);
               binder.bind(Crypto.class).toInstance(crypto);
View Full Code Here

                        .getBytes(UTF_8))));
               PublicKey publicKey = keyfactory
                        .generatePublic(publicKeySpec(ByteSource.wrap(PUBLIC_KEY.getBytes(UTF_8))));
               KeyPair keyPair = new KeyPair(publicKey, privateKey);
               openSshKey = SshKeys.encodeAsOpenSSH(RSAPublicKey.class.cast(publicKey));
               final Crypto crypto = createMock(Crypto.class);
               KeyPairGenerator rsaKeyPairGenerator = createMock(KeyPairGenerator.class);
               final SecureRandom secureRandom = createMock(SecureRandom.class);
               expect(crypto.rsaKeyPairGenerator()).andReturn(rsaKeyPairGenerator).anyTimes();
               rsaKeyPairGenerator.initialize(2048, secureRandom);
               expectLastCall().anyTimes();
               expect(rsaKeyPairGenerator.genKeyPair()).andReturn(keyPair).anyTimes();
               replay(crypto, rsaKeyPairGenerator, secureRandom);
               binder.bind(Crypto.class).toInstance(crypto);
View Full Code Here

      Injector injector = ContextBuilder.newBuilder(new ChefApiMetadata()).credentials(USER_ID, PRIVATE_KEY)
            .modules(ImmutableSet.<Module> of(new MockModule(), new NullLoggingModule())).buildInjector();

      HttpUtils utils = injector.getInstance(HttpUtils.class);
      Crypto crypto = injector.getInstance(Crypto.class);

      Supplier<PrivateKey> privateKey = injector.getInstance(Key.get(new TypeLiteral<Supplier<PrivateKey>>() {
      }));

      signing_obj = new SignedHeaderAuth(new SignatureWire(),
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testDecryptStringWithBouncyCastle() throws Exception {
    Crypto crypto = new BouncyCastleCrypto();
    decryptAndVerify(crypto);

  }
View Full Code Here

   *
   * @throws Exception .
   */
  @Test
  public void testDecryptStringWithJCE() throws Exception {
    Crypto crypto = new JCECrypto();
    decryptAndVerify(crypto);

  }
View Full Code Here

      openSshKey = SshKeys.encodeAsOpenSSH(RSAPublicKey.class.cast(publicKey));
   }

   @Test
   public void testApply() {
      final Crypto crypto = createMock(Crypto.class);
      KeyPairGenerator rsaKeyPairGenerator = createMock(KeyPairGenerator.class);
      final SecureRandom secureRandom = createMock(SecureRandom.class);

      expect(crypto.rsaKeyPairGenerator()).andReturn(rsaKeyPairGenerator);
      rsaKeyPairGenerator.initialize(2048, secureRandom);
      expect(rsaKeyPairGenerator.genKeyPair()).andReturn(keyPair);

      replay(crypto, rsaKeyPairGenerator, secureRandom);
View Full Code Here

TOP

Related Classes of org.jclouds.crypto.Crypto

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.