public synchronized void free() { if(sSignatureAlgorithmName != null) { Secur32.INSTANCE.FreeContextBuffer(sSignatureAlgorithmName); sSignatureAlgorithmName = null; } if(sEncryptAlgorithmName != null) { Secur32.INSTANCE.FreeContextBuffer(sEncryptAlgorithmName); sEncryptAlgorithmName = null; } } }
public synchronized void free() { if(SessionKey != null) { Secur32.INSTANCE.FreeContextBuffer(SessionKey); SessionKey = null; } } }
/** * Free native buffer * * @return {@link WinError#SEC_E_OK} if ok */ public synchronized int free() { if (sUserName != null) { int result = Secur32.INSTANCE.FreeContextBuffer(sUserName); sUserName = null; return result; } return WinError.SEC_E_OK; } }
public synchronized void free() { if(PackageInfo != null) { Secur32.INSTANCE.FreeContextBuffer(PackageInfo.pPkgInfo.getPointer()); PackageInfo = null; } } }
/** * Get the security packages installed on the current computer. * @return * An array of SSPI security packages. */ public static SecurityPackage[] getSecurityPackages() { IntByReference pcPackages = new IntByReference(); PSecPkgInfo pPackageInfo = new PSecPkgInfo(); int rc = Secur32.INSTANCE.EnumerateSecurityPackages(pcPackages, pPackageInfo); if(W32Errors.SEC_E_OK != rc) { throw new Win32Exception(rc); } SecPkgInfo[] packagesInfo = pPackageInfo.toArray(pcPackages.getValue()); ArrayList<SecurityPackage> packages = new ArrayList<SecurityPackage>(pcPackages.getValue()); for(SecPkgInfo packageInfo : packagesInfo) { SecurityPackage securityPackage = new SecurityPackage(); securityPackage.name = packageInfo.Name.toString(); securityPackage.comment = packageInfo.Comment.toString(); packages.add(securityPackage); } rc = Secur32.INSTANCE.FreeContextBuffer(pPackageInfo.pPkgInfo.getPointer()); if(W32Errors.SEC_E_OK != rc) { throw new Win32Exception(rc); } return packages.toArray(new SecurityPackage[0]); } }
/** * Get the security packages installed on the current computer. * @return * An array of SSPI security packages. */ public static SecurityPackage[] getSecurityPackages() { IntByReference pcPackages = new IntByReference(); PSecPkgInfo.ByReference pPackageInfo = new PSecPkgInfo.ByReference(); int rc = Secur32.INSTANCE.EnumerateSecurityPackages(pcPackages, pPackageInfo); if(W32Errors.SEC_E_OK != rc) { throw new Win32Exception(rc); } SecPkgInfo[] packagesInfo = pPackageInfo.toArray(pcPackages.getValue()); ArrayList<SecurityPackage> packages = new ArrayList<SecurityPackage>(pcPackages.getValue()); for(SecPkgInfo packageInfo : packagesInfo) { SecurityPackage securityPackage = new SecurityPackage(); securityPackage.name = packageInfo.Name.toString(); securityPackage.comment = packageInfo.Comment.toString(); packages.add(securityPackage); } rc = Secur32.INSTANCE.FreeContextBuffer(pPackageInfo.pPkgInfo.getPointer()); if(W32Errors.SEC_E_OK != rc) { throw new Win32Exception(rc); } return packages.toArray(new SecurityPackage[0]); } }