@Override public boolean apply(String s) { if (Strings.isNullOrEmpty(s)) return false; PasswordData data = client.getPasswordDataInRegion(region, s); if (data == null) return false; return !Strings.isNullOrEmpty(data.getPasswordData()); } };
@Override public boolean apply(@Nullable String s) { if (Strings.isNullOrEmpty(s)) return false; data.set(windowsApi.getPasswordDataForInstance(instance.getId())); if (data.get() == null) return false; return !Strings.isNullOrEmpty(data.get().getPasswordData()); } };
@Override public boolean apply(@Nullable String s) { if (Strings.isNullOrEmpty(s)) return false; data.set(windowsApi.getPasswordDataForInstance(instance.getId())); if (data.get() == null) return false; return !Strings.isNullOrEmpty(data.get().getPasswordData()); } };
@Override public boolean apply(@Nullable String s) { if (Strings.isNullOrEmpty(s)) return false; data.set(windowsApi.getPasswordDataForInstance(instance.getId())); if (data.get() == null) return false; return !Strings.isNullOrEmpty(data.get().getPasswordData()); } };
@Override public boolean apply(@Nullable String s) { if (Strings.isNullOrEmpty(s)) return false; data.set(windowsApi.getPasswordDataForInstance(instance.getId())); if (data.get() == null) return false; return !Strings.isNullOrEmpty(data.get().getPasswordData()); } };
@Override public boolean apply(@Nullable String s) { if (Strings.isNullOrEmpty(s)) return false; data.set(windowsApi.getPasswordDataForInstance(instance.getId())); if (data.get() == null) return false; return !Strings.isNullOrEmpty(data.get().getPasswordData()); } };
@Override public boolean apply(@Nullable String s) { if (Strings.isNullOrEmpty(s)) return false; PasswordData data = ec2Client.getWindowsServices().getPasswordDataInRegion(region, s); if (data == null) return false; return !Strings.isNullOrEmpty(data.getPasswordData()); } };
@Override public LoginCredentials apply(@Nullable PasswordDataAndPrivateKey dataAndKey) { if (dataAndKey == null) return null; try { KeySpec keySpec = Pems.privateKeySpec(dataAndKey.getPrivateKey()); KeyFactory kf = crypto.rsaKeyFactory(); PrivateKey privKey = kf.generatePrivate(keySpec); Cipher cipher = crypto.cipher("RSA"); cipher.init(Cipher.DECRYPT_MODE, privKey); byte[] cipherText = base64().decode(dataAndKey.getPasswordData().getPasswordData()); byte[] plainText = cipher.doFinal(cipherText); String password = new String(plainText, Charsets.US_ASCII); return LoginCredentials.builder() .user("Administrator") .password(password) .noPrivateKey() .build(); } catch(Exception e) { throw Throwables.propagate(e); } } }
@Override public LoginCredentials apply(@Nullable PasswordDataAndPrivateKey dataAndKey) { if (dataAndKey == null) return null; try { KeySpec keySpec = Pems.privateKeySpec(dataAndKey.getPrivateKey()); KeyFactory kf = crypto.rsaKeyFactory(); PrivateKey privKey = kf.generatePrivate(keySpec); Cipher cipher = crypto.cipher("RSA"); cipher.init(Cipher.DECRYPT_MODE, privKey); byte[] cipherText = base64().decode(dataAndKey.getPasswordData().getPasswordData()); byte[] plainText = cipher.doFinal(cipherText); String password = new String(plainText, Charsets.US_ASCII); return LoginCredentials.builder() .user("Administrator") .password(password) .noPrivateKey() .build(); } catch(Exception e) { throw Throwables.propagate(e); } } }
@Override public LoginCredentials apply(@Nullable PasswordDataAndPrivateKey dataAndKey) { if (dataAndKey == null) return null; try { KeySpec keySpec = Pems.privateKeySpec(dataAndKey.getPrivateKey()); KeyFactory kf = crypto.rsaKeyFactory(); PrivateKey privKey = kf.generatePrivate(keySpec); Cipher cipher = crypto.cipher("RSA"); cipher.init(Cipher.DECRYPT_MODE, privKey); byte[] cipherText = base64().decode(dataAndKey.getPasswordData().getPasswordData()); byte[] plainText = cipher.doFinal(cipherText); String password = new String(plainText, Charsets.US_ASCII); return LoginCredentials.builder() .user("Administrator") .password(password) .noPrivateKey() .build(); } catch (Exception e) { throw Throwables.propagate(e); } } }
@Override public LoginCredentials apply(@Nullable PasswordDataAndPrivateKey dataAndKey) { if (dataAndKey == null) return null; try { KeySpec keySpec = Pems.privateKeySpec(dataAndKey.getPrivateKey()); KeyFactory kf = crypto.rsaKeyFactory(); PrivateKey privKey = kf.generatePrivate(keySpec); Cipher cipher = crypto.cipher("RSA"); cipher.init(Cipher.DECRYPT_MODE, privKey); byte[] cipherText = base64().decode(dataAndKey.getPasswordData().getPasswordData()); byte[] plainText = cipher.doFinal(cipherText); String password = new String(plainText, Charsets.US_ASCII); return LoginCredentials.builder() .user("Administrator") .password(password) .noPrivateKey() .build(); } catch (Exception e) { throw Throwables.propagate(e); } } }
@Override public LoginCredentials apply(@Nullable PasswordDataAndPrivateKey dataAndKey) { if (dataAndKey == null) return null; try { KeySpec keySpec = Pems.privateKeySpec(dataAndKey.getPrivateKey()); KeyFactory kf = crypto.rsaKeyFactory(); PrivateKey privKey = kf.generatePrivate(keySpec); Cipher cipher = crypto.cipher("RSA"); cipher.init(Cipher.DECRYPT_MODE, privKey); byte[] cipherText = base64().decode(dataAndKey.getPasswordData().getPasswordData()); byte[] plainText = cipher.doFinal(cipherText); String password = new String(plainText, Charsets.US_ASCII); return LoginCredentials.builder() .user("Administrator") .password(password) .noPrivateKey() .build(); } catch (Exception e) { throw Throwables.propagate(e); } } }
public Builder fromPasswordData(PasswordData in) { return this.instanceId(in.getInstanceId()).timestamp(in.getTimestamp()).passwordData(in.getPasswordData()); } }
public Builder fromPasswordData(PasswordData in) { return this.instanceId(in.getInstanceId()).timestamp(in.getTimestamp()).passwordData(in.getPasswordData()); } }
public Builder fromPasswordData(PasswordData in) { return this.instanceId(in.getInstanceId()).timestamp(in.getTimestamp()).passwordData(in.getPasswordData()); } }
public Builder fromPasswordData(PasswordData in) { return this.instanceId(in.getInstanceId()).timestamp(in.getTimestamp()).passwordData(in.getPasswordData()); } }
public Builder fromPasswordData(PasswordData in) { return this.instanceId(in.getInstanceId()).timestamp(in.getTimestamp()).passwordData(in.getPasswordData()); } }