Class ResetWindowsPassword
java.lang.Object
org.jclouds.googlecomputeengine.compute.functions.ResetWindowsPassword
- All Implemented Interfaces:
com.google.common.base.Function<Map<String,
,?>, String> Function<Map<String,
?>, String>
public class ResetWindowsPassword
extends Object
implements com.google.common.base.Function<Map<String,?>,String>
References:
In brief, the sequence is:
- Generate a temporary key for encrypting and decrypting the password
- Send the RSA public key to the instance, by settings its metadata
- Retrieve the result from the
Instance.SerialPortOutput
- Decode and decrypt the result.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ResetWindowsPassword
(GoogleComputeEngineApi api, Crypto crypto, com.google.common.base.Predicate<AtomicReference<Operation>> operationDone, Json json) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
decryptPassword
(String message, KeyPair keys) Decrypts the given password - the encrypted text is base64-encoded.extractKeyMetadata
(KeyPair pair, String userName, String email) Generates the metadata value for this keypair.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.google.common.base.Function
equals
-
Field Details
-
logger
-
-
Constructor Details
-
ResetWindowsPassword
@Inject protected ResetWindowsPassword(GoogleComputeEngineApi api, Crypto crypto, com.google.common.base.Predicate<AtomicReference<Operation>> operationDone, Json json)
-
-
Method Details
-
apply
-
decryptPassword
protected String decryptPassword(String message, KeyPair keys) throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException Decrypts the given password - the encrypted text is base64-encoded. As per the GCE docs, assumes it was encrypted with algorithm "RSA/NONE/OAEPPadding", and UTF-8. -
extractKeyMetadata
protected Map<String,String> extractKeyMetadata(KeyPair pair, String userName, String email) throws NoSuchAlgorithmException, InvalidKeySpecException Generates the metadata value for this keypair. Extracts the public key's the RSA spec's modulus and exponent, encoded as Base-64, and an expires date.- Parameters:
pair
-- Returns:
- Throws:
NoSuchAlgorithmException
InvalidKeySpecException
-