public final class Key extends Object
| Modifier and Type | Method and Description |
|---|---|
XorCipher |
cipher()
Get the cipher related to this key
The cipher instance is saved into the key
|
String |
encode()
Encode the key to hexadecimal string
|
static Key |
generate()
Generate a new random key, with length of 128 characters
The generated key contains only displayable characters
|
static Key |
generate(@Positive int size)
Generate a new random key
The generated key contains only displayable characters
|
static Key |
generate(@Positive int size,
SecureRandom random)
Generate a new random key
The generated key contains only displayable characters
|
static Key |
parse(@MinLen(value=2) String input)
Parse an hexadecimal key string
https://github.com/Emudofus/Dofus/blob/1.29/dofus/aks/Aks.as#L232
|
@MinLen(value=1) String |
toString() |
public Key(@MinLen(value=1) String key)
@Pure public XorCipher cipher()
@Pure public String encode()
For parse the encoded key@Pure public static Key parse(@MinLen(value=2) String input)
input - Key to parseIllegalArgumentException - When invalid key is givenNumberFormatException - When invalid hexadecimal string is givenFor generate the hexadecimal stringpublic static Key generate()
public static Key generate(@Positive int size)
size - The key sizepublic static Key generate(@Positive int size, SecureRandom random)
size - The key sizerandom - The random number generatorCopyright © 2022. All rights reserved.