Пример #1
0
// tests whether encryption and decryption are symmetrical operations
func (s *SecureStringSuite) TestEncryptDecryptSymmetry(c *gc.C) {
	for _, input := range testInputs {
		enc, err := securestring.Encrypt(input)
		c.Assert(err, gc.IsNil)
		dec, err := securestring.Decrypt(enc)
		c.Assert(err, gc.IsNil)
		c.Assert(dec, gc.Equals, input)
	}
}
Пример #2
0
// tests whether the output of the module is compatible with PowerShell's SecureString and is accepted as valid
func (s *SecureStringSuite) TestConvertEncryptedToPowerShellSS(c *gc.C) {
	for _, input := range testInputs {
		enc, err := securestring.Encrypt(input)
		c.Assert(err, gc.IsNil)

		psresp, err := runPowerShellCommands(fmt.Sprintf("\"%s\" | ConvertTo-SecureString", enc))
		c.Assert(err, gc.IsNil)

		c.Assert(psresp, gc.Equals, "System.Security.SecureString")
	}
}