Package org.eclipse.net4j.util.security

# Class SecurityUtil

java.lang.Object
org.eclipse.net4j.util.security.SecurityUtil

public final class SecurityUtil extends Object

Author:
  Eike Stepper

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`DEFAULT_ITERATION_COUNT`
`static final byte[]`
`DEFAULT_SALT`
`static final String`
`PBE_WITH_MD5_AND_DES`

## Method Summary

Modifier and Type
Method
Description
`static byte[]`
`encrypt(byte[] data, char[] password, String algorithmName, byte[] salt, int count)`
Deprecated.
As of 3.3.
`static Map<String,Object>`
`getAuthorizationContext()`
`static byte[]`
`pbe(byte[] data, char[] password, String algorithmName, byte[] salt, int count, int mode)`
`static byte[]`
`pbeDecrypt(byte[] data, char[] password, String algorithmName, byte[] salt, int count)`
`static byte[]`
`pbeEncrypt(byte[] data, char[] password, String algorithmName, byte[] salt, int count)`
`static void`
`setAuthorizationContext(Map<String,Object> authorizationContext)`
`static char[]`
`toCharArray(String str)`
`static String`
`toString(char[] chars)`
`static void`
`withAuthorizationContext(Map<String,Object> authorizationContext, Runnable runnable)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### PBE_WITH_MD5_AND_DES

public static final String PBE_WITH_MD5_AND_DES

See Also:
  - Constant Field Values

### DEFAULT_SALT

public static final byte[] DEFAULT_SALT

Since:
  2.0

### DEFAULT_ITERATION_COUNT

public static final int DEFAULT_ITERATION_COUNT

Since:
  2.0
See Also:
  - Constant Field Values

## Method Details

### pbe

public static byte[] pbe(byte[] data, char[] password, String algorithmName, byte[] salt, int count, int mode) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException

Throws:
  `NoSuchAlgorithmException`
  `InvalidKeySpecException`
  `NoSuchPaddingException`
  `InvalidKeyException`
  `InvalidAlgorithmParameterException`
  `IllegalBlockSizeException`
  `BadPaddingException`
Since:
  3.13

### pbeDecrypt

public static byte[] pbeDecrypt(byte[] data, char[] password, String algorithmName, byte[] salt, int count) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException

Throws:
  `NoSuchAlgorithmException`
  `InvalidKeySpecException`
  `NoSuchPaddingException`
  `InvalidKeyException`
  `InvalidAlgorithmParameterException`
  `IllegalBlockSizeException`
  `BadPaddingException`
Since:
  3.13

### pbeEncrypt

public static byte[] pbeEncrypt(byte[] data, char[] password, String algorithmName, byte[] salt, int count) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException

Throws:
  `NoSuchAlgorithmException`
  `InvalidKeySpecException`
  `NoSuchPaddingException`
  `InvalidKeyException`
  `InvalidAlgorithmParameterException`
  `IllegalBlockSizeException`
  `BadPaddingException`
Since:
  3.13

### toString

public static String toString(char[] chars)

Since:
  3.14

### toCharArray

public static char[] toCharArray(String str)

Since:
  3.14

### getAuthorizationContext

public static Map<String,Object> getAuthorizationContext()

Since:
  3.23

### setAuthorizationContext

public static void setAuthorizationContext(Map<String,Object> authorizationContext)

Since:
  3.23

### withAuthorizationContext

public static void withAuthorizationContext(Map<String,Object> authorizationContext, Runnable runnable)

Since:
  3.23

### encrypt

@Deprecated public static byte[] encrypt(byte[] data, char[] password, String algorithmName, byte[] salt, int count) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException
Deprecated.
As of 3.3. use `pbeEncrypt(byte[], char[], String, byte[], int)`.

Throws:
  `NoSuchAlgorithmException`
  `InvalidKeySpecException`
  `NoSuchPaddingException`
  `InvalidKeyException`
  `InvalidAlgorithmParameterException`
  `IllegalBlockSizeException`
  `BadPaddingException`
Since:
  2.0