Thanks, but this isn't possible. The company who owns the webservice give all the customers keys in this format. They provide me a example in vb.net and I have to do the same in R. I got the following information for the decryption:
Algorithm AES (Rijndael)
Key-Length 128 Bit
Block-Length 128 Bit
Modus CBC
Padding PKCS7
Decryption process
- Decode the string Base64
- Separate initialization vector and data:
- Initialization vector: the first 16 bytes
- Data: the remaining bytes
- Decrypt the data
VB.net example:
Imports System.Security.Cryptography
Public Function AutoiDecryption(ByVal InputStr As String, ByVal CryptKey As String) As String
'Advanced Encryption Standard (Rijndael)
Dim AES As RijndaelManaged
Dim Buffer() As Byte
Dim EncryptedBytes() As Byte
Dim EncryptedBytesWithIV() As Byte
Dim IVBytes As Byte()
Const IV_LENGTH As Integer = 16
Const KEY_SIZE As Integer = 128
Try
'Base64 decryption
EncryptedBytesWithIV = Convert.FromBase64String(InputStr)
'Separate initialization vector and data
IVBytes = New Byte(IV_LENGTH - 1) {}
EncryptedBytes = New Byte(EncryptedBytesWithIV.Length - IVBytes.Length - 1) {}
Array.Copy(EncryptedBytesWithIV, 0, IVBytes, 0, IVBytes.Length)
Array.Copy(EncryptedBytesWithIV, IVBytes.Length, EncryptedBytes, 0, EncryptedBytes.Length)
'InitializeCrypto Provider
AES = New RijndaelManaged
AES.Mode = CipherMode.CBC
AES.KeySize = KEY_SIZE
AES.BlockSize = KEY_SIZE
AES.Padding = PaddingMode.PKCS7
AES.Key = System.Text.Encoding.Default.GetBytes(CryptKey)
AES.IV = IVBytes
'Data Decryption
Buffer = AES.CreateDecryptor().TransformFinalBlock(EncryptedBytes, 0, EncryptedBytes.Length)
CompanyDecryption = System.Text.Encoding.UTF8.GetString(Buffer)
Catch ex As Exception
CompanyDecryption = ""
End Try
End Function