org.cogroo.addon.util
Class SecurityUtil
java.lang.Object
org.cogroo.addon.util.SecurityUtil
public class SecurityUtil
- extends Object
SecurityUtil
public SecurityUtil()
encrypt
public byte[] encrypt(PrivateKey privateKey,
byte[] encryptedSecretKey,
String data)
throws InvalidKeyException
- Encrypt data using an key encrypted with a private key.
- Parameters:
privateKey
- the private key to decrypt the secret keyencryptedSecretKey
- a encrypted secret keydata
- the data to encrypt
- Returns:
- the encrypted data
- Throws:
InvalidKeyException
- one of the keys is invalid
decrypt
public byte[] decrypt(PrivateKey privateKey,
byte[] encryptedSecretKey,
byte[] encryptedText)
genKeyPair
public KeyPair genKeyPair()
encode
public String encode(byte[] key)
encodeURLSafe
public static String encodeURLSafe(String data)
encodeURLSafe
public String encodeURLSafe(byte[] key)
decodeURLSafe
public byte[] decodeURLSafe(String encoded)
encrypt
public String encrypt(String plaintext)
- Encrypt a string using SHA
- Parameters:
plaintext
- the original text
- Returns:
- resultant hash
Copyright © 2012-2013 CoGrOO. All Rights Reserved.