/// <summary> /// Note! This can and likely will throw if the algorithm was given a hardware-based key. /// </summary> public byte[] GetKeyIfExportable() { if (KeyInPlainText) { return(_outer.BaseKey); } else { using (CngKey cngKey = ProduceCngKey()) { return(cngKey.GetSymmetricKeyDataIfExportable(_outer.GetNCryptAlgorithmIdentifier())); } } }