Questions tagged [cryptoswift]

CryptoSwift is a collection of standards and algorithms to fulfill most cryptographic needs.

CryptoSwift is a collection of standards and algorithms to fulfill most cryptographic needs.

81 questions
2
votes
1 answer

Trouble with AES Cryptography (specifically encrypting with CryptoSwift and decrypting with PyCryptodome

I am currently trying to use AES cryptography to encrypt and decrypt a string that always has a length of 9 characters. What I am trying to do is to encrypt the string in swift and then decrypt that encrypted string in python. I am using AES…
2
votes
0 answers

CryptoSwift AES Encryption and Decryption

I am using "CryptoSwift 1.0.0" and Swift 5 with Xcode 10.2 for an iOS app, CryptoSwift encryption works fine, and also my PHP server Encryption and Decryption. But I am getting this error: dataPaddingRequired when this method is getting executed:…
Molax
  • 39
  • 1
  • 10
2
votes
1 answer

Cryptoswift Framework is not being accessed

I am using Cryptoswift framework for encryption and decryption. I am using an Xcode project inside another Xcode project.The subproject is not able to access the framework Cryptoswift in spite of using pods for the main project. In addition to that,…
tamizhachi_
  • 65
  • 10
2
votes
1 answer

Swift - AES 128 ctr, ciphertext too long

I want to use the aes-128-ctr in Swift with the CryptoSwift library, however my resulting ciphertext is too long. My IV is 16 bytes, salt 32 bytes and the aes plaintext is also 32 bytes, why is the resulting ciphertext 48 bytes, thus padded with…
phoebus
  • 1,280
  • 1
  • 16
  • 36
2
votes
1 answer

CryptoSwift with Xcode 9 and AES Decryption

I am using Xcode 9.0 and CryptoSwift (0.7.2). I am trying to extend String to decrypt an AES128 encrypted string. I've added CryptoSwift successfully with Pods but I get the following compilation error - what am I doing wrong? 'PKCS7' cannot be…
PhilBot
  • 748
  • 18
  • 85
  • 173
2
votes
3 answers

Why is MD5 hashing so hard and in Swift 3?

Ok, so every now and then you come across problems that you've solved before using various frameworks and libraries and whatnot found on the internet and your problem is solved relatively quick and easy and you also learn why your problem was a…
vaid
  • 1,390
  • 12
  • 33
2
votes
1 answer

CryptoSwift and Objective-C

How I can use CryptoSwift to my Objective-C project? I have an Objective-C project and want to use Encryption Library CryptoSwift for that. I have successfully used the single Swift file into my Objective-C project, but how to use a Swift project as…
2
votes
2 answers

Data encrypted by CryptoSwift is not same as Node.js

I used CryptoSwift to encrypt some data, and then encrypted the same data using Node.js. But the results are not same. I asked the author, he said it's not a bug. I don't know where I made a mistake. Here are pictures of how I used CryptoSwift and…
Neko
  • 23
  • 5
2
votes
3 answers

Could not decrypt a base64String using CryptoSwift

String for encryption "secret" after encryption "64c2VjcmV0" this is the code that works properly let inputNSData: NSData = input.dataUsingEncoding(NSUTF8StringEncoding)! let inputBytes: [UInt8] = inputNSData.arrayOfBytes() let key:…
Cloy
  • 2,141
  • 23
  • 32
2
votes
1 answer

Padding error with CryptoSwift and Ruby AES

I am having a hard time getting CryptoSwift to play nicely with Ruby's OpenSSL AES My Swift code: let key = ("12345678901234567890123456789012" as NSString).dataUsingEncoding(NSUTF8StringEncoding)?.arrayOfBytes() //32 chars because im testing AES…
Deekor
  • 9,144
  • 16
  • 69
  • 121
2
votes
2 answers

Converting objective-c code to swift

I really need some help to convert the objective-c code to swift using CryptoSwift. I'm not sure how to use functions like: bzero, getCString, malloc in Swift. +(NSData*)encryptData:(NSData*)data { static NSString *key = @"BitCave012345678"; …
Bart
  • 21
  • 5
2
votes
1 answer

Encrypt/Decrypt string in iOS using CryptoSwift

I'm trying to encrypt a string and then decrypt it back using CryptoSwift. Here's the code: let key: [UInt8] = [0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c] let iv: [UInt8] =…
Salavat Khanov
  • 4,100
  • 2
  • 15
  • 27
1
vote
1 answer

Decrypt Fernet Encrypted Text(PYTHON) in SWIFT

I have generated an Encrypted Text is Python using cryptography from cryptography.fernet import Fernet message = "my deep dark secret".encode() f = Fernet(key) encrypted = f.encrypt(message) # decrypting from cryptography.fernet import…
1
vote
0 answers

iOS JWE AES GCM 256

I am trying to implement JWE token in Swift using JOSESwift (modified to support AES-GCM 256) and CryptoSwift(need to support iOS 11+). I am able to encrypt and decrypt using public/private key pair. But when the same JWE token passed on to Java…
1
vote
1 answer

Message Digest in swift

I need to generate Message Digest in Swift with SHA-256 variant with SALT. I am using CryptoSwift library in Swift for all the encryption/decryption. Now I am stuck at generating Message Digest which matches with Java code in Android as below. If…
Dhaval H. Nena
  • 3,992
  • 1
  • 37
  • 50