public class CryptoUtil extends Object
Modifier and Type | Method and Description |
---|---|
byte[] |
base64DecodeAndDecrypt(String base64CipherText)
Base64 decode the given value and decrypt using the WSO2 WSAS key
|
byte[] |
decrypt(byte[] cipherTextBytes)
Decrypt the given cipher text value using the WSO2 WSAS key
|
byte[] |
encrypt(byte[] plainTextBytes)
Encrypt a given plain text
|
String |
encryptAndBase64Encode(byte[] plainText)
Encrypt the given plain text and base64 encode the encrypted content.
|
static CryptoUtil |
getDefaultCryptoUtil()
This method returns CryptoUtil object, where this should only be used at runtime,
after the server is properly initialized, or else, use the overloaded method,
CryptoUtil#getDefaultCryptoUtil(ServerConfigurationService).
|
static CryptoUtil |
getDefaultCryptoUtil(org.wso2.carbon.base.api.ServerConfigurationService serverConfigService,
org.wso2.carbon.registry.core.service.RegistryService registryService)
This method is used to get the CryptoUtil object given the ServerConfigurationService
service.
|
org.wso2.carbon.registry.core.service.RegistryService |
getRegistryService() |
org.wso2.carbon.base.api.ServerConfigurationService |
getServerConfigService() |
static org.wso2.carbon.registry.core.service.RegistryService |
lookupRegistryService() |
public static CryptoUtil getDefaultCryptoUtil()
public static org.wso2.carbon.registry.core.service.RegistryService lookupRegistryService()
public static CryptoUtil getDefaultCryptoUtil(org.wso2.carbon.base.api.ServerConfigurationService serverConfigService, org.wso2.carbon.registry.core.service.RegistryService registryService)
serverConfigService
- The ServerConfigurationService objectregistryService
- The RegistryService objectpublic org.wso2.carbon.base.api.ServerConfigurationService getServerConfigService()
public org.wso2.carbon.registry.core.service.RegistryService getRegistryService()
public byte[] encrypt(byte[] plainTextBytes) throws CryptoException
plainTextBytes
- The plaintext bytes to be encryptedCryptoException
- On error during encryptionpublic String encryptAndBase64Encode(byte[] plainText) throws CryptoException
plainText
- The plaintext value to be encrypted and base64
encodedCryptoException
- On error during encryptionpublic byte[] decrypt(byte[] cipherTextBytes) throws CryptoException
cipherTextBytes
- The cipher text to be decryptedCryptoException
- On an error during decryptionpublic byte[] base64DecodeAndDecrypt(String base64CipherText) throws CryptoException
base64CipherText
- Base64 encoded cipher textCryptoException
- On an error during decryptionCopyright © 2016 WSO2 Inc. All rights reserved.