public static string IpcfEncryptFileStream( Stream inputStream, string inputFilePath, SafeInformationProtectionLicenseHandle licenseHandle, EncryptFlags flags, bool suppressUI, bool offline, bool hasUserConsent, IntPtr parentWindow, SymmetricKeyCredential symmKey, ref Stream outputStream, WaitHandle cancelCurrentOperation = null) { SafeIpcPromptContext ipcContext = SafeNativeMethods.CreateIpcPromptContext( suppressUI, offline, hasUserConsent, parentWindow, symmKey, cancelCurrentOperation); return(IpcfEncryptFileStream( inputStream, inputFilePath, licenseHandle, flags, ref outputStream, ipcContext)); }
public static string IpcfEncryptFile( string inputFile, SafeInformationProtectionLicenseHandle licenseHandle, EncryptFlags flags, bool suppressUI, bool offline, bool hasUserConsent, IntPtr parentWindow, SymmetricKeyCredential symmKey, string outputDirectory = null, WaitHandle cancelCurrentOperation = null) { int hr = 0; IntPtr encryptedFileName = IntPtr.Zero; string outputFileName = null; SafeIpcPromptContext ipcContext = SafeNativeMethods.CreateIpcPromptContext(suppressUI, offline, hasUserConsent, parentWindow, symmKey, cancelCurrentOperation); try { using (var wrappedContext = ipcContext.Wrap()) { hr = UnsafeFileApiMethods.IpcfEncryptFile( inputFile, licenseHandle.Value, (uint)EncryptLicenseInfoTypes.IPCF_EF_LICENSE_HANDLE, (uint)flags, (IpcPromptContext)wrappedContext, outputDirectory, out encryptedFileName); } SafeNativeMethods.ThrowOnErrorCode(hr); outputFileName = Marshal.PtrToStringUni(encryptedFileName); if (null == outputFileName || 0 == outputFileName.Length) { outputFileName = inputFile; } } finally { UnsafeFileApiMethods.IpcFreeMemory(encryptedFileName); SafeNativeMethods.ReleaseIpcPromptContext(ipcContext); } return(outputFileName); }
public static string IpcfEncryptFileStream( Stream inputStream, string inputFilePath, SafeInformationProtectionLicenseHandle licenseHandle, EncryptFlags flags, bool suppressUI, bool offline, bool hasUserConsent, System.Windows.Forms.Form parentForm, SymmetricKeyCredential symmKey, ref Stream outputStream) { int hr = 0; IntPtr encryptedFileName = IntPtr.Zero; string outputFileName = null; ILockBytes ilInputStream = new ILockBytesOverStream(inputStream); ILockBytes ilOutputStream = new ILockBytesOverStream(outputStream); SafeIpcPromptContext ipcContext = SafeNativeMethods.CreateIpcPromptContext(suppressUI, offline, hasUserConsent, parentForm, symmKey); try { hr = UnsafeFileApiMethods.IpcfEncryptFileStream( ilInputStream, inputFilePath, licenseHandle.Value, (uint)EncryptLicenseInfoTypes.IPCF_EF_LICENSE_HANDLE, (uint)flags, (IpcPromptContext)ipcContext, ilOutputStream, out encryptedFileName); SafeNativeMethods.ThrowOnErrorCode(hr); outputFileName = Marshal.PtrToStringUni(encryptedFileName); if (null == outputFileName || 0 == outputFileName.Length) { outputFileName = inputFilePath; } } finally { UnsafeFileApiMethods.IpcFreeMemory(encryptedFileName); } return(outputFileName); }
public static string IpcfEncryptFileStream( Stream inputStream, string inputFilePath, SafeInformationProtectionLicenseHandle licenseHandle, EncryptFlags flags, ref Stream outputStream, SafeIpcPromptContext ipcContext = null) { int hr = 0; IntPtr encryptedFileName = IntPtr.Zero; string outputFileName = null; ILockBytes ilInputStream = new ILockBytesOverStream(inputStream); ILockBytes ilOutputStream = new ILockBytesOverStream(outputStream); if (null == ipcContext) //use the default { ipcContext = SafeNativeMethods.CreateIpcPromptContext(false, false, false, IntPtr.Zero); } try { using (var wrappedContext = ipcContext.Wrap()) { hr = UnsafeFileApiMethods.IpcfEncryptFileStream( ilInputStream, inputFilePath, licenseHandle.Value, (uint)EncryptLicenseInfoTypes.IPCF_EF_LICENSE_HANDLE, (uint)flags, (IpcPromptContext)wrappedContext, ilOutputStream, out encryptedFileName); } SafeNativeMethods.ThrowOnErrorCode(hr); outputFileName = Marshal.PtrToStringUni(encryptedFileName); if (null == outputFileName || 0 == outputFileName.Length) { outputFileName = inputFilePath; } } finally { UnsafeFileApiMethods.IpcFreeMemory(encryptedFileName); } return(outputFileName); }
public static string IpcfEncryptFile( string inputFile, SafeInformationProtectionLicenseHandle licenseHandle, EncryptFlags flags, bool suppressUI, bool offline, bool hasUserConsent, Form parentWindow, SymmetricKeyCredential symmKey, string outputDirectory = null) { return(IpcfEncryptFile( inputFile, licenseHandle, flags, suppressUI, offline, hasUserConsent, IpcWindow.Create(parentWindow).Handle, symmKey, outputDirectory)); }
public static string IpcfEncryptFileStream( Stream inputStream, string inputFilePath, SafeInformationProtectionLicenseHandle licenseHandle, EncryptFlags flags, bool suppressUI, bool offline, bool hasUserConsent, Form parentWindow, SymmetricKeyCredential symmKey, ref Stream outputStream) { return(IpcfEncryptFileStream( inputStream, inputFilePath, licenseHandle, flags, suppressUI, offline, hasUserConsent, IpcWindow.Create(parentWindow).Handle, symmKey, ref outputStream)); }
// IPC_LI_OWNER - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx public static void IpcSetLicenseOwner(SafeInformationProtectionLicenseHandle licenseHandle, string owner) { int hr = 0; IntPtr pvLicenseInfo = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IpcUser))); try { // Create a userinfo object IpcUser uInfo = new IpcUser(); uInfo.userID = owner; uInfo.userType = UserIdType.Email; Marshal.StructureToPtr(uInfo, pvLicenseInfo, false); hr = UnsafeNativeMethods.IpcSetLicenseProperty( licenseHandle, false, (uint)LicensePropertyType.Owner, pvLicenseInfo); ThrowOnErrorCode(hr); } finally { Marshal.FreeHGlobal(pvLicenseInfo); } }
// IPC_LI_CONTENT_KEY - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx public static SafeInformationProtectionKeyHandle IpcGetLicenseContentKey(SafeInformationProtectionLicenseHandle licenseHandle) { SafeInformationProtectionKeyHandle keyHandle = null; int hr = 0; IntPtr licenseInfoPtr = IntPtr.Zero; try { hr = UnsafeNativeMethods.IpcGetLicenseProperty( licenseHandle, (uint)LicensePropertyType.ReferralInfoUrl, 0, out licenseInfoPtr); ThrowOnErrorCode(hr); keyHandle = new SafeInformationProtectionKeyHandle(licenseInfoPtr); } finally { UnsafeNativeMethods.IpcFreeMemory(licenseInfoPtr); } return keyHandle; }
// IPC_LI_REFERRAL_INFO_URL - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx public static string IpcGetLicenseReferralInfoUrl(SafeInformationProtectionLicenseHandle licenseHandle) { string referralInfoUrl = null; int hr = 0; IntPtr licenseInfoPtr = IntPtr.Zero; try { hr = UnsafeNativeMethods.IpcGetLicenseProperty( licenseHandle, (uint)LicensePropertyType.ReferralInfoUrl, 0, out licenseInfoPtr); ThrowOnErrorCode(hr); referralInfoUrl = Marshal.PtrToStringUni(licenseInfoPtr); } finally { UnsafeNativeMethods.IpcFreeMemory(licenseInfoPtr); } return referralInfoUrl; }
// IPC_LI_DESCRIPTOR - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx public static TemplateInfo IpcGetLicenseDescriptor(SafeInformationProtectionLicenseHandle licenseHandle, CultureInfo cultureInfo) { IpcTemplateInfo ipcTemplateInfo = null; int hr = 0; IntPtr licenseInfoPtr = IntPtr.Zero; try { uint lcid = 0; if (null != cultureInfo) { lcid = (uint)(cultureInfo.LCID); } hr = UnsafeNativeMethods.IpcGetLicenseProperty( licenseHandle, (uint)LicensePropertyType.Descriptor, lcid, out licenseInfoPtr); ThrowOnErrorCode(hr); ipcTemplateInfo = (IpcTemplateInfo)Marshal.PtrToStructure(licenseInfoPtr, typeof(IpcTemplateInfo)); } finally { UnsafeNativeMethods.IpcFreeMemory(licenseInfoPtr); } return IpcTemplateInfoToTemplateInfo(ipcTemplateInfo); }
// License Properties - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx // IpcSetLicenseProperty() - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535271(v=vs.85).aspx // IPC_LI_VALIDITY_TIME - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx public static void IpcSetLicenseValidityTime(SafeInformationProtectionLicenseHandle licenseHandle, Term validityTime) { int hr = 0; IpcTerm ipcValidityTime = TermToIpcTerm(validityTime); IntPtr licenseInfoPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IpcTerm))); try { Marshal.StructureToPtr(ipcValidityTime, licenseInfoPtr, false); hr = UnsafeNativeMethods.IpcSetLicenseProperty( licenseHandle, false, (uint)LicensePropertyType.ValidityTime, licenseInfoPtr); ThrowOnErrorCode(hr); } finally { Marshal.FreeHGlobal(licenseInfoPtr); } }
// IPC_LI_APP_SPECIFIC_DATA - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx public static void IpcSetLicenseAppSpecificData(SafeInformationProtectionLicenseHandle licenseHandle, NameValueCollection applicationSpecificData) { int hr = 0; IntPtr licenseInfoPtr = IntPtr.Zero; if (applicationSpecificData.Count == 0) { hr = UnsafeNativeMethods.IpcSetLicenseProperty( licenseHandle, true, (uint)LicensePropertyType.AppSpecificData, licenseInfoPtr); ThrowOnErrorCode(hr); } else { licenseInfoPtr = MarshalNameValueListToNative(applicationSpecificData); try { hr = UnsafeNativeMethods.IpcSetLicenseProperty( licenseHandle, false, (uint)LicensePropertyType.AppSpecificData, licenseInfoPtr); ThrowOnErrorCode(hr); } finally { Marshal.FreeHGlobal(licenseInfoPtr); } } }
public static string IpcfEncryptFile( string inputFile, SafeInformationProtectionLicenseHandle licenseHandle, EncryptFlags flags, bool suppressUI, bool offline, bool hasUserConsent, System.Windows.Forms.Form parentForm, SymmetricKeyCredential symmKey, string outputDirectory = null) { int hr = 0; IntPtr encryptedFileName = IntPtr.Zero; string outputFileName = null; SafeIpcPromptContext ipcContext = SafeNativeMethods.CreateIpcPromptContext(suppressUI, offline, hasUserConsent, parentForm, symmKey); try { hr = UnsafeFileApiMethods.IpcfEncryptFile( inputFile, licenseHandle.Value, (uint)EncryptLicenseInfoTypes.IPCF_EF_LICENSE_HANDLE, (uint)flags, (IpcPromptContext)ipcContext, outputDirectory, out encryptedFileName); SafeNativeMethods.ThrowOnErrorCode(hr); outputFileName = Marshal.PtrToStringUni(encryptedFileName); if (null == outputFileName || 0 == outputFileName.Length) { outputFileName = inputFile; } } finally { UnsafeFileApiMethods.IpcFreeMemory(encryptedFileName); SafeNativeMethods.ReleaseIpcPromptContext(ipcContext); } return outputFileName; }
// IPC_LI_INTERVAL_TIME - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx public static uint IpcGetLicenseIntervalTime(SafeInformationProtectionLicenseHandle licenseHandle) { uint intervalTime = 0; int hr = 0; IntPtr licenseInfoPtr = IntPtr.Zero; try { hr = UnsafeNativeMethods.IpcGetLicenseProperty( licenseHandle, (uint)LicensePropertyType.IntervalTime, 0, out licenseInfoPtr); ThrowOnErrorCode(hr); intervalTime = (uint)Marshal.ReadInt32(licenseInfoPtr); } finally { UnsafeNativeMethods.IpcFreeMemory(licenseInfoPtr); } return intervalTime; }
// IPC_LI_CONTENT_ID - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx public static string IpcGetLicenseContentId(SafeInformationProtectionLicenseHandle licenseHandle) { string contentId = null; int hr = 0; IntPtr licenseInfoPtr = IntPtr.Zero; try { hr = UnsafeNativeMethods.IpcGetLicenseProperty( licenseHandle, (uint)LicensePropertyType.ContentId, 0, out licenseInfoPtr); ThrowOnErrorCode(hr); contentId = Marshal.PtrToStringUni(licenseInfoPtr); } finally { UnsafeNativeMethods.IpcFreeMemory(licenseInfoPtr); } return contentId; }
// IpcGetLicenseProperty - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535265(v=vs.85).aspx // IPC_LI_VALIDITY_TIME - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx public static Term IpcGetLicenseValidityTime(SafeInformationProtectionLicenseHandle licenseHandle) { IpcTerm ipcValidityTime = null; int hr =0; IntPtr licenseInfoPtr = IntPtr.Zero; try { hr = UnsafeNativeMethods.IpcGetLicenseProperty( licenseHandle, (uint)LicensePropertyType.ValidityTime, 0, out licenseInfoPtr); ThrowOnErrorCode(hr); ipcValidityTime = (IpcTerm)Marshal.PtrToStructure(licenseInfoPtr, typeof(IpcTerm)); } finally { UnsafeNativeMethods.IpcFreeMemory(licenseInfoPtr); } return IpcTermToTerm(ipcValidityTime); }
// IPC_LI_CONTENT_KEY - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx public static void IpcSetLicenseContentKey(SafeInformationProtectionLicenseHandle licenseHandle, SafeInformationProtectionKeyHandle hKey) { int hr = 0; hr = UnsafeNativeMethods.IpcSetLicenseProperty( licenseHandle, false, (uint)LicensePropertyType.ContentKey, hKey.Value); ThrowOnErrorCode(hr); }
// IPC_LI_REFERRAL_INFO_URL - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx public static void IpcSetLicenseReferralInfoUrl(SafeInformationProtectionLicenseHandle licenseHandle, string referralInfoUrl) { int hr = 0; IntPtr LicenseInfoPtr = Marshal.StringToHGlobalUni(referralInfoUrl); try { hr = UnsafeNativeMethods.IpcSetLicenseProperty( licenseHandle, false, (uint)LicensePropertyType.ReferralInfoUrl, LicenseInfoPtr); ThrowOnErrorCode(hr); } finally { Marshal.FreeHGlobal(LicenseInfoPtr); } }
// IPC_LI_DESCRIPTOR - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx public static void IpcSetLicenseDescriptor(SafeInformationProtectionLicenseHandle licenseHandle, TemplateInfo templateInfo) { int hr = 0; IntPtr LicenseInfoPtr = IntPtr.Zero; if (null == templateInfo) { hr = UnsafeNativeMethods.IpcSetLicenseProperty( licenseHandle, true, (uint)LicensePropertyType.Descriptor, LicenseInfoPtr); ThrowOnErrorCode(hr); } else { LicenseInfoPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IpcTemplateInfo))); try { IpcTemplateInfo ipcTemplateInfo = TemplateInfoToIpcTemplateInfo(templateInfo); Marshal.StructureToPtr(ipcTemplateInfo, LicenseInfoPtr, false); hr = UnsafeNativeMethods.IpcSetLicenseProperty( licenseHandle, false, (uint)LicensePropertyType.Descriptor, LicenseInfoPtr); ThrowOnErrorCode(hr); } finally { Marshal.FreeHGlobal(LicenseInfoPtr); } } }
internal static extern int IpcCreateLicenseFromTemplateID( [In, MarshalAs(UnmanagedType.LPWStr)] string wszTemplateID, [In, MarshalAs(UnmanagedType.U4)] uint dwFlags, [In] IntPtr pvReserved, [Out] out SafeInformationProtectionLicenseHandle phLicense);
// IPC_LI_INTERVAL_TIME - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx public static void IpcSetLicenseIntervalTime(SafeInformationProtectionLicenseHandle licenseHandle, uint intervalTime) { int hr = 0; IntPtr LicenseInfoPtr = Marshal.AllocHGlobal(sizeof(uint)); try { Marshal.WriteInt32(LicenseInfoPtr, (int)intervalTime); hr = UnsafeNativeMethods.IpcSetLicenseProperty( licenseHandle, false, (uint)LicensePropertyType.IntervalTime, LicenseInfoPtr); ThrowOnErrorCode(hr); } finally { Marshal.FreeHGlobal(LicenseInfoPtr); } }
internal static extern int IpcSetLicenseProperty( [In] SafeInformationProtectionLicenseHandle hLicense, [In, MarshalAs(UnmanagedType.Bool)] bool fDelete, [In, MarshalAs(UnmanagedType.U4)] uint dwPropID, [In] IntPtr pvProperty);
// IPC_LI_OWNER - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx public static string IpcGetLicenseOwner(SafeInformationProtectionLicenseHandle licenseHandle) { string owner = null; int hr =0; IntPtr licenseInfoPtr = IntPtr.Zero; try { hr = UnsafeNativeMethods.IpcGetLicenseProperty( licenseHandle, (uint)LicensePropertyType.Owner, 0, out licenseInfoPtr); ThrowOnErrorCode(hr); IpcUser userInfo = (IpcUser)Marshal.PtrToStructure(licenseInfoPtr, typeof(IpcUser)); owner = userInfo.userID; } finally { UnsafeNativeMethods.IpcFreeMemory(licenseInfoPtr); } return owner; }
// IPC_LI_USER_RIGHTS_LIST - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx public static void IpcSetLicenseUserRightsList(SafeInformationProtectionLicenseHandle licenseHandle, Collection<UserRights> userRightsList) { int hr = 0; IntPtr licenseInfoPtr = IntPtr.Zero; if (0 == userRightsList.Count) { // If there are no user entries, we can just delete the entire list hr = UnsafeNativeMethods.IpcSetLicenseProperty( licenseHandle, true, (uint)LicensePropertyType.UserRightsList, licenseInfoPtr); ThrowOnErrorCode(hr); } else { try { licenseInfoPtr = MarshalUserRightsListToNative(userRightsList); hr = UnsafeNativeMethods.IpcSetLicenseProperty( licenseHandle, false, (uint)LicensePropertyType.UserRightsList, licenseInfoPtr); ThrowOnErrorCode(hr); } finally { CleanupMarshalledUserRightsList(ref licenseInfoPtr); } } }
// IPC_LI_USER_RIGHTS_LIST - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx public static Collection<UserRights> IpcGetLicenseUserRightsList(SafeInformationProtectionLicenseHandle licenseHandle) { Collection<UserRights> userRightsList = new Collection<UserRights>(); int hr = 0; IntPtr licenseInfoPtr = IntPtr.Zero; try { hr = UnsafeNativeMethods.IpcGetLicenseProperty( licenseHandle, (uint)LicensePropertyType.UserRightsList, 0, out licenseInfoPtr); ThrowOnErrorCode(hr); MarshalUserRightsListToManaged(licenseInfoPtr, userRightsList); } finally { UnsafeNativeMethods.IpcFreeMemory(licenseInfoPtr); } return userRightsList; }
// IPC_LI_APP_SPECIFIC_DATA - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx public static NameValueCollection IpcGetLicenseAppSpecificData(SafeInformationProtectionLicenseHandle licenseHandle) { NameValueCollection applicationSpecificData = new NameValueCollection(); int hr = 0; IntPtr licenseInfoPtr = IntPtr.Zero; try { hr = UnsafeNativeMethods.IpcGetLicenseProperty( licenseHandle, (uint)LicensePropertyType.AppSpecificData, 0, out licenseInfoPtr); ThrowOnErrorCode(hr); MarshalNameValueListToManaged(licenseInfoPtr, applicationSpecificData); } finally { UnsafeNativeMethods.IpcFreeMemory(licenseInfoPtr); } return applicationSpecificData; }
internal static extern int IpcCreateLicenseFromScratch( [In, MarshalAs(UnmanagedType.LPStruct)] IpcTemplateIssuer pTemplateIssuer, [In, MarshalAs(UnmanagedType.U4)] uint dwFlags, [In] IntPtr pvReserved, [Out] out SafeInformationProtectionLicenseHandle phLicense);
// IPC_LI_CONNECTION_INFO - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535287(v=vs.85).aspx public static ConnectionInfo IpcGetLicenseConnectionInfo(SafeInformationProtectionLicenseHandle licenseHandle) { IpcConnectionInfo ipcConnectionInfo = null; int hr =0; IntPtr licenseInfoPtr = IntPtr.Zero; try { hr = UnsafeNativeMethods.IpcGetLicenseProperty( licenseHandle, (uint)LicensePropertyType.ConnectionInfo, 0, out licenseInfoPtr); ThrowOnErrorCode(hr); ipcConnectionInfo = (IpcConnectionInfo)Marshal.PtrToStructure(licenseInfoPtr, typeof(IpcConnectionInfo)); } finally { UnsafeNativeMethods.IpcFreeMemory(licenseInfoPtr); } return IpcConnectionInfoToConnectionInfo(ipcConnectionInfo); }
internal static extern int IpcGetLicenseProperty( [In] SafeInformationProtectionLicenseHandle hLicense, [In, MarshalAs(UnmanagedType.U4)] uint dwPropID, [In, MarshalAs(UnmanagedType.U4)] uint lcid, [Out] out IntPtr ppvProperty);
// IpcSerializeLicense() using License Handle - http://msdn.microsoft.com/en-us/library/windows/desktop/hh535269(v=vs.85).aspx public static byte[] IpcSerializeLicense( SafeInformationProtectionLicenseHandle licenseHandle, SerializeLicenseFlags flags, bool suppressUI, bool offline, bool hasUserConsent, System.Windows.Forms.Form parentForm, out SafeInformationProtectionKeyHandle keyHandle) { byte[] license = null; int hr = 0; SafeIpcPromptContext ipcPromptContext = CreateIpcPromptContext(suppressUI, offline, hasUserConsent, parentForm); IntPtr licensePtr = IntPtr.Zero; try { hr = UnsafeNativeMethods.IpcSerializeLicense( licenseHandle.Value, SerializationInputType.License, (uint)flags, (IpcPromptContext)ipcPromptContext, out keyHandle, out licensePtr); ThrowOnErrorCode(hr); license = MarshalIpcBufferToManaged(licensePtr); } finally { UnsafeNativeMethods.IpcFreeMemory(licensePtr); } return license; }