Giter Club home page Giter Club logo

cryptojs.swift's People

Contributors

canopener avatar etienne-martin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cryptojs.swift's Issues

Not so much an issue as I need help

Hi first of all I want to thank you for your library. I'm complete noob to data encryption and just need help with it.

Back-end API uses CryptoJS for encrypting their responses. I've tried your library and looks like it works perfect locally. It was easy. But when I try to decrypt server response it returns result "undefined"

Here is the sample of response:
"{\"ct\":\"clK4DaN8jn6uep8Uj42usi/ZfoyWBVjIK8Kx8kds5uf9cwp7l0dUheIrdcJwtgUSw70TKD/zrTYAoiRQQ6f1VxoYFroLzeKn+VWlkmqam69tHA66BOc6POnLChBxa9dOhm3Vju+y5IPTPwcclJvgFHKBsnUCdka0yfg6QvELAHef6J6hIYXnithqcSXgJZYMqlSPI0Y5qhysSj8CT9/EINC/LsHCaVEEi1q7x0BoYZ2VaZHXDKmI7Rpdksca5/BB6VoRP3Bno9r095ymoeljGBgpaY61cJLDCbTC2H500ChuwXz3HtacdtFczEu/ornk9QoRkBGc7G/zV2CMMZuiprz9OIiIrpUDVnkDOp5FljGhGCsXXB5r0tH0g1ajs7b5EUwtXV9xIMbmQTzGogJtTALrfHmp0WofTw16HNygFq/OyGbxTZBHVQlFlEdHtCubyKSSWIPJIyXhIEKaJMoSf74kF0Fmum+6cPtH/1uRcbpPrc7g3sI/7L0aO6vZhOYqtzLnk6ZcgUVx8725fWigwVVZJfVSnh2TKLN61Cyszlk5RgJ7w0Bg3Rx24QRMmpq9P6wMZO9gNabl0nA/1g2Pd8SvGux3Mo5KLqAZtRsFzrTLcZ45gR04bhFEciYce70U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ghO9YQD46mif4B2PTPbC00SQ8hpFHt2EZWDJ/WR3cylKKTyzy293R0MHlpKSdKXu1sB/ao6QRTyIn8enxtv1VD1M52K2PgGaUJgm3O9vuKNhTv/bTcMux0ZtrHm828nL2YkOTW7gJtQQh0OESVRgD6thsYvgja7DZC97nMl9fDeaUaOiU5KlM4FTYF09ASSzG1OvheJ+tYDHfQXg\",\"iv\":\"1312f7120c39478c3c1a8695835608aa\",\"s\":\"f63c9a8b42209432\"}"

and a key that suppose to help:

8aa1ec1e6948b481d1ee450c94ffb2edc774877325df4d05aca2e5827497ed33

DES Mode

Hi,
Do this library decrypt DES files?
Thanks,
Rafa

Swift 3 compiler warnings

Using xcode 8.2 I get compiler warnings from the evaluateScript calls, e.g.

cryptoJScontext?evaluateScript(cryptoJS)
the warning is: Expression of type JSValue? is unused

the fix seems to be to change the lines to

let _ = cryptoJScontext?evaluateScript(cryptoJS)

Any comments?

Thanks

Does it work with Swift 3?

Hi. I've converted CryptoJS.swift to Swift 3 using Xcode 8 converter and the converted file seems to be ok but I can't make it work.

When I try

    // Load the TripleDES module
     let TripleDES = CryptoJS.TripleDES()

    // Basic TripleDES encryption
    let encrypted = TripleDES.encrypt("secretMessage", secretKey: "password123")
    print("SECRETMESSAGE: " + encrypted)

    // Basic TripleDES decryption
    let decrypted = TripleDES.decrypt(encrypted, secretKey: "password123")
    print("RESULT: " + decrypted)

I get:

Loaded tripledes.js
SECRETMESSAGE: Optional(undefined)
RESULT: Optional(undefined)

What am I missing?

Convert crypto.js algorithm in swift

Hi, I would like to know how to use the below js method to work in Swift:

let key = "Q8pTgdOC7h25qKVncJlzDA=="
let message = "TestAnitaa009"
let base64Key = CryptoJS.enc.Base64.parse(key);

var iv = base64Key

let encryptedValue = CryptoJS.AES.encrypt(message, base64Key, {
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7,
iv: base64Key
});

//The above code outputs = Oz9b31UvNTW8rFfGUOfB5A==

I tried using this library to help to do the same in Swift. But I am not able to. Any help is appreciated. Thanks a lot

Can't decrypt data with aes decrypt function in native

I have function used in cross platform application and i want to convert it into native please help me?

function fn_decryptData(var_data,var_key){
	var encrypted = CryptoJS.enc.Base64.parse(var_data);
	var encodedString = btoa(var_key);
	var key = CryptoJS.enc.Base64.parse(encodedString);
	var iv = `CryptoJS.enc.Base64.parse('somestring');`
	return (CryptoJS.enc.Utf8.stringify(CryptoJS.AES.decrypt({ ciphertext: encrypted },key,{ mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7, iv: iv,  })));
}

How to use this in native to decrypt data

NSdata decryption

Hi,
How can I use this library for decrypt nsdata file ?

Thanks,
vafa

CBC mode

hello, isn't there a CBC mode ? and a PKCS7 padding ? thanks

DES encryption does not work properly

If you comment out CryptoJS.AES then the DES method will not work. Example: Comment out the ViewController class 16-38 in the project, then CryptoJS.TripleDES() will not work.

Encryption options in Swift 3

I'm trying to set the encryption options in swift 3 and I'm able to get the code to compile with the code below

AES.encrypt(secretMessage: pw, secretKey: key, options: ["mode": CryptoJS.mode.ECB()] as? AnyObject)!
However this causes the app to crash when the code is run. Without the as? AnyObject the code won't compile and I get the error Contextual type 'AnyObject' cannot be used with dictionary literal.

Any suggestions?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.