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

  • SEARCH
  • Home
  • 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 7944031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:26:27+00:00 2026-06-04T00:26:27+00:00

How can i create RSA encryption public key from ‘Modulus’ and ‘Exponent’ in iOS.?

  • 0

How can i create RSA encryption public key from ‘Modulus’ and ‘Exponent’ in iOS.?
I have created public key from keychain. is it possible from string ‘Modulus’ and ‘Exponent’ values?

  • 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-06-04T00:26:29+00:00Added an answer on June 4, 2026 at 12:26 am

    See this answer over here

    https://stackoverflow.com/a/10643894/584616

    https://github.com/StCredZero/SCZ-BasicEncodingRules-iOS

    SCZ-BasicEncodingRules-iOS

    Implementation of Basic Encoding Rules to enable import of RSA keys to iOS
    KeyChain using exponent. Code targets iOS 5 with ARC.

    Let’s say you already have a modulus and exponent from
    an RSA public key as an NSData in variables named pubKeyModData and
    pubKeyModData. Then the following code will create an NSData containing that RSA
    public key, which you can then insert into the iOS or OS X Keychain.

    NSMutableArray *testArray = [[NSMutableArray alloc] init];
    [testArray addObject:pubKeyModData];
    [testArray addObject:pubKeyExpData];
    NSData *testPubKey = [testArray berData];
    

    This would allow you to store the key using the addPeerPublicKey:keyBits: method from SecKeyWrapper in the Apple CryptoExercise example. Or, from the perspective of the low-level API, you can use SecItemAdd().

    NSString * peerName = @"Test Public Key";
    
    NSData * peerTag = 
       [[NSData alloc] 
           initWithBytes:(const void *)[peerName UTF8String] 
           length:[peerName length]];
    
    NSMutableDictionary * peerPublicKeyAttr = [[NSMutableDictionary alloc] init];
    
    [peerPublicKeyAttr 
       setObject:(__bridge id)kSecClassKey 
       forKey:(__bridge id)kSecClass];
    [peerPublicKeyAttr 
       setObject:(__bridge id)kSecAttrKeyTypeRSA 
       forKey:(__bridge id)kSecAttrKeyType];
    [peerPublicKeyAttr 
       setObject:peerTag 
       forKey:(__bridge id)kSecAttrApplicationTag];
    [peerPublicKeyAttr 
       setObject:testPubKey 
       forKey:(__bridge id)kSecValueData];
    [peerPublicKeyAttr 
       setObject:[NSNumber numberWithBool:YES] 
       forKey:(__bridge id)kSecReturnPersistentRef];
    
    sanityCheck = SecItemAdd((__bridge CFDictionaryRef) peerPublicKeyAttr, (CFTypeRef *)&persistPeer);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What I understand about RSA is that Alice can create a public and a
I am trying to create my public/private rsa key pair with msysgit I run
I used openSSL command to create 2 files: 1 for RSA public key &
Using Java I have created RSA keypairs. Using Java I can use these keys
I use ssh-keygen -T rsa to create a public key for accessing my git
I have the byte array of the RSA Public Key. I found on the
You can create a clustered index on a column other than primary key column
I'm trying to import an RSA public/private key pair generated with the Win32 Crypto
I think I know how to create custom encrypted RSA keys, but how can
I have a function that generates a BouncyCastle RSA key pair. I need to

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.