public static void ValidatePersistedCIK(StorSimpleCmdletBase cmdlet, string resourceId) { string cik = RetrieveCIK(cmdlet, resourceId); StorSimpleCryptoManager cryptMgr = new StorSimpleCryptoManager(cmdlet.StorSimpleClient); string rakPub = cryptMgr.GetPlainTextRAKPub(cik); if (string.IsNullOrEmpty(rakPub)) { throw new Exception(Resources.PersistedCIKValidationFailed); } }
public static void ValidatePersistedCIK(StorSimpleCmdletBase cmdlet, string resourceId) { string cik = RetrieveCIK(cmdlet, resourceId); StorSimpleCryptoManager cryptMgr = new StorSimpleCryptoManager(cmdlet.StorSimpleClient); string rakPub = null; try { rakPub = cryptMgr.GetPlainTextRAKPub(cik); } catch (CryptographicException exception) { // This case is to handle the failures during decrypting the Rak Pub cmdlet.WriteVerbose(string.Format(Resources.CIKInvalidWithException, exception.Message)); throw new Exception(Resources.CIKInvalidWhileDecrypting); } if (string.IsNullOrEmpty(rakPub)) { throw new Exception(Resources.PersistedCIKValidationFailed); } }