schema: Encode URL safe random vnc password string

/+= may break on some environments, url safe encoded passwords will have -_,
characters which are more acceptable

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit 19cc5eb9e6f1b5127bf01e4c1ae061875e61cb4c)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2015-06-01 14:10:54 +02:00
parent 23c990f7c9
commit 6c1dde8f86

View File

@ -210,7 +210,7 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
byte[] randomBytes = new byte[16];
random.nextBytes(randomBytes);
vncPassword = Base64.encodeBase64String(randomBytes);
vncPassword = Base64.encodeBase64URLSafeString(randomBytes);
} catch (NoSuchAlgorithmException e) {
s_logger.error("Unexpected exception in SecureRandom Algorithm selection ", e);
}