+

Search Tips | Advanced Search


WLSecurityUtils Class Reference

Inherits from NSObject
Declared in WLSecurityUtils.h

IBM MobileFirst Platform Security Utilities.


Tasks

      + generateKeyWithPassword:andSalt:andIterations:error:
      	
      	
      	
      
      	
      		

        + encryptText:withKey:error:
        	
        	
        	
        
        	
        		

          + decryptWithKey:andDictionary:error:
          	
          	
          	
          
          	
          		

            + getRandomStringFromServerWithBytes:timeout:completionHandler:
            	
            	
            	
            
            	
            		

              + generateRandomStringWithBytes:
              	
              	
              	
              
              	
              		

                + base64StringFromData:length:
                	
                	
                	
                
                	
                		


                Class Methods


                base64StringFromData:length:

                Encodes data to an NSString with Base64 encoding.

                  + (NSString *)base64StringFromData:(NSData *)data length:(int)length
                  
                      
                  	
                  	
                  


                  Parameters

                    data

                    Data

                    length

                    Length of the input


                  Return Value

                  Base64 encoded NSString


                  Availability

                  IBM Worklight V6.2.0


                  Declared In

                  WLSecurityUtils.h


                  decodeBase64WithFiles:output:

                  Reads Base64 encoded file and writes decoded output to output file

                    + (void)decodeBase64WithFiles:(NSFileHandle *)handleInput output:(NSString *)outputFileName
                    
                        
                    	
                    	
                    


                    Parameters

                      handleInput

                      Handle to input file; the caller is responsible for closing the file

                      outputFileName

                      Full path to output file


                    Availability

                    IBM Worklight V6.2.0


                    Declared In

                    WLSecurityUtils.h


                    decryptWithKey:andDictionary:error:

                    Decrypts a dictionary that contains: src (source), v (version), ct (cipher text) and the iv (initialization vector).

                      + (NSString *)decryptWithKey:(NSString *)key andDictionary:(NSDictionary *)encryptedObj error:(NSError **)error
                      
                          
                      	
                      	
                      


                      Parameters

                        key

                        The key used for decryption

                        error

                        Error

                        ciphertext

                        The encrypted text to decrypt


                      Return Value

                      The decrypted text


                      Availability

                      IBM Worklight V6.2.0


                      Declared In

                      WLSecurityUtils.h


                      encryptText:withKey:error:

                      Encrypts text with a key.

                        + (NSDictionary *)encryptText:(NSString *)text withKey:(NSString *)key error:(NSError **)error
                        
                            
                        	
                        	
                        


                        Parameters

                          text

                          The text to encrypt

                          key

                          The key used for encryption

                          error

                          Error


                        Return Value

                        An NSDictionary with the cipher text (ct), the IV (iv), the source (src) and the version (v).


                        Availability

                        IBM Worklight V6.2.0


                        Declared In

                        WLSecurityUtils.h


                        generateKeyWithPassword:andSalt:andIterations:error:

                        Generates a key by using the PBKDF2 algorithm.

                          + (NSString *)generateKeyWithPassword:(NSString *)pass andSalt:(NSString *)salt andIterations:(NSInteger)iterations error:(NSError **)error
                          
                              
                          	
                          	
                          


                          Parameters

                            pass

                            The password used to generate the key

                            salt

                            The salt used to generate the key

                            iterations

                            The number of iterations that is passed to the key generation algorithm

                            error

                            Error


                          Return Value

                          The generated key.


                          Availability

                          IBM Worklight V6.2.0


                          Declared In

                          WLSecurityUtils.h


                          generateRandomStringWithBytes:

                          Generates a random string locally.

                            + (NSString *)generateRandomStringWithBytes:(int)bytes
                            
                                
                            	
                            	
                            


                            Parameters

                              bytes

                              Number of bytes used to generate the random string


                            Return Value

                            The random string, nil if the operation fails


                            Availability

                            IBM Worklight V6.2.0


                            Declared In

                            WLSecurityUtils.h


                            getRandomStringFromServerWithBytes:timeout:completionHandler:

                            Gets a random string from the server.

                              + (void)getRandomStringFromServerWithBytes:(int)bytes timeout:(int)timeout completionHandler:(void ( ^ ) ( NSURLResponse *response , NSData *data , NSError *connectionError ))handler
                              
                                  
                              	
                              	
                              


                              Parameters

                                bytes

                                Number of bytes that are used to generate the random string (maximum 64 bytes)

                                timeout

                                The time to wait for the network request to finish

                                handler

                                Called when the request finished, the data field will have the random string (NSUTF8StringEncoding)


                              Availability

                              IBM Worklight V6.2.0


                              Declared In

                              WLSecurityUtils.h


                              © Copyright IBM Corp. 2017