Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3500428
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:43:58+00:00 2026-05-18T12:43:58+00:00

I have a program that is interacting with the Keychain. You pass in a

  • 0

I have a program that is interacting with the Keychain. You pass in a pointer to a void pointer and the keychain directs it, I guess, to the password, you also pass in a UInt32 pointer and it will point to the length of the password.

I then need to use this as a NSString, I tried to directly cast it as such but it was aggregating more bits then needed and that won’t work for a password. I tried to use:

NSString* password=[NSString stringWithCharacters:passwordData length:passwordLength];

This changed password into chinese like characters. Not sure why. When I print the description in debug mode it gives me:

Printing description of password:
\u3039\u4839\u6d6f\u2165\u1566�

I was able to get it to work perfectly with:

NSString* password=[NSString stringWithCString:passwordData length:passwordLength];

but this was depreciated and I would like to avoid using that. I am very new to both C and Objective-C and void pointers throw me for a loop. In debug mode I looked at the memory that the pointer was pointing to and it is definitely at that memory location. I tried using const char* but it didn’t like that either saying that the variables may not have been initialized.

Here is the method I am using to get to the keychain

- (OSStatus) GetPasswordKeychain:(void*)passwordData length:(UInt32*)passwordLength label:(NSString*)serverName
{
 status=SecKeychainFindGenericPassword(NULL, (UInt32)[serverName length], [serverName UTF8String], usernameLength, username,passwordLength , passwordData, NULL);
return status;
}

Is there a way to get a NSString to point there with the right length and have it be the right stuff. Thanks for the help. This place is great!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:43:58+00:00Added an answer on May 18, 2026 at 12:43 pm

    After scouring the Apple website I discovered the method:

    - (id)initWithBytes:(const void *)bytes length:(NSUInteger)length encoding:(NSStringEncoding)encoding
    

    and that works great.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program that will calculate the minimal area taken by fitting rectangles
I have a program that spits out both standard error and standard out, and
I have a program that creates a Windows user account using the NetUserAdd() API
I have a program that uses the mt19937 random number generator from boost::random. I
I have a program that spits out an Excel workbook in Excel 2003 XML
I have a program that monitors debug messages and I have tried using a
I have a program that runs osql.exe from microsoft sql server tools directory and
I have a program that I need to run under *nix and windows. because
I have a program that when it starts, opens a winform (it is the
I have a program that can have a lot of parameters (we have over

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.