public class DefaultSecureTokenService extends java.lang.Object implements SecureTokenService
SecureTokenService| Modifier and Type | Field and Description |
|---|---|
protected static int |
AESIV_LENGTH |
protected static int |
ENCRYPT_KEY_LENGTH |
protected static java.lang.String |
ENCRYPTION_CIPHER |
protected static int |
MD5_LENGTH |
protected static java.lang.String |
MESSAGEDIGEST_ALGORITHM |
protected static java.lang.String |
RANDOM_ALGORITHM |
| Constructor and Description |
|---|
DefaultSecureTokenService() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected boolean |
arrayEquals(byte[] array1,
int offset1,
byte[] array2,
int offset2,
int length) |
protected javax.crypto.spec.SecretKeySpec |
buildSecretKey(byte[] encryptionKeyBytes) |
protected int[] |
computePaddingLengths() |
protected java.lang.String |
convert(byte[] data) |
protected java.lang.String |
createChecksum(java.lang.String data) |
protected byte[] |
decodeHexString(java.lang.String text) |
protected byte[] |
decrypt(java.lang.String encryptedText,
byte[] encryptionKeyBytes) |
SecureToken |
decryptData(java.lang.String token)
Decrypt the token to a SecureToken.
|
protected java.lang.String |
encrypt(byte[] plainText,
byte[] encryptionKeyBytes) |
java.lang.String |
encryptData(SecureToken data)
Encrypt the SecureToken parameter to a String
|
protected byte[] |
generatePadding(int length) |
protected byte[] |
generateSignature(byte[] data,
int offset,
int length,
byte[] signatureKeyBytes) |
protected byte[] |
getEncryptionKeyBytes() |
protected java.lang.String |
getEncryptionKeyHex() |
protected java.security.SecureRandom |
getRandom() |
protected byte[] |
getSignatureKeyBytes() |
protected java.lang.String |
getSignatureKeyHex() |
void |
setEncryptionKeyHex(java.lang.String encryptionKeyHex) |
void |
setSignatureKeyHex(java.lang.String signatureKeyHex) |
protected void |
skipPadding(java.io.DataInputStream dataInputStream) |
protected boolean |
validateSignature(byte[] dataBytes,
int dataOffset,
int dataLength,
byte[] signatureBytes,
int signatureOffset,
byte[] signatureKeyBytes) |
protected static final int ENCRYPT_KEY_LENGTH
protected static final int MD5_LENGTH
protected static final int AESIV_LENGTH
protected static final java.lang.String ENCRYPTION_CIPHER
protected static final java.lang.String RANDOM_ALGORITHM
protected static final java.lang.String MESSAGEDIGEST_ALGORITHM
public void afterPropertiesSet()
throws DecoderException,
java.security.NoSuchAlgorithmException
DecoderExceptionjava.security.NoSuchAlgorithmExceptionprotected java.security.SecureRandom getRandom()
protected byte[] getSignatureKeyBytes()
protected byte[] getEncryptionKeyBytes()
public java.lang.String encryptData(SecureToken data)
SecureTokenServiceencryptData in interface SecureTokenServicedata - The unencrypted token datapublic SecureToken decryptData(java.lang.String token)
SecureTokenServicedecryptData in interface SecureTokenServicetoken - the encrypted token dataprotected byte[] decodeHexString(java.lang.String text)
throws DecoderException
DecoderExceptionprotected int[] computePaddingLengths()
protected byte[] generatePadding(int length)
protected byte[] generateSignature(byte[] data,
int offset,
int length,
byte[] signatureKeyBytes)
throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmExceptionprotected java.lang.String encrypt(byte[] plainText,
byte[] encryptionKeyBytes)
throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionprotected java.lang.String convert(byte[] data)
protected javax.crypto.spec.SecretKeySpec buildSecretKey(byte[] encryptionKeyBytes)
protected void skipPadding(java.io.DataInputStream dataInputStream)
throws java.io.IOException
java.io.IOExceptionprotected boolean validateSignature(byte[] dataBytes,
int dataOffset,
int dataLength,
byte[] signatureBytes,
int signatureOffset,
byte[] signatureKeyBytes)
throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmExceptionprotected boolean arrayEquals(byte[] array1,
int offset1,
byte[] array2,
int offset2,
int length)
protected byte[] decrypt(java.lang.String encryptedText,
byte[] encryptionKeyBytes)
throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionprotected java.lang.String createChecksum(java.lang.String data)
throws java.io.IOException,
java.security.NoSuchAlgorithmException
java.io.IOExceptionjava.security.NoSuchAlgorithmExceptionprotected java.lang.String getSignatureKeyHex()
public void setSignatureKeyHex(java.lang.String signatureKeyHex)
signatureKeyHex - the signatureKeyHex to setprotected java.lang.String getEncryptionKeyHex()
public void setEncryptionKeyHex(java.lang.String encryptionKeyHex)
encryptionKeyHex - the encryptionKeyHex to setCopyright © 2018 SAP SE. All Rights Reserved.