No Description

FIRInstanceIDKeyPair.h 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright 2019 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. @interface FIRInstanceIDKeyPair : NSObject
  18. - (instancetype)init __attribute__((
  19. unavailable("Use -initWithPrivateKey:publicKey:publicKeyData:privateKeyData: instead.")));
  20. ;
  21. /**
  22. * Initialize a new 2048 bit RSA keypair. This also stores the keypair in the Keychain
  23. * Preferences.
  24. *
  25. * @param publicKey The publicKey stored in Keychain.
  26. * @param privateKey The privateKey stored in Keychain.
  27. * @param publicKeyData The publicKey in NSData format.
  28. * @param privateKeyData The privateKey in NSData format.
  29. *
  30. * @return A new KeyPair instance with the generated public and private key.
  31. */
  32. - (instancetype)initWithPrivateKey:(SecKeyRef)privateKey
  33. publicKey:(SecKeyRef)publicKey
  34. publicKeyData:(NSData *)publicKeyData
  35. privateKeyData:(NSData *)privateKeyData NS_DESIGNATED_INITIALIZER;
  36. /**
  37. * The public key in the RSA 20148 bit generated KeyPair.
  38. *
  39. * @return The 2048 bit RSA KeyPair's public key.
  40. */
  41. @property(nonatomic, readonly, strong) NSData *publicKeyData;
  42. /**
  43. * The private key in the RSA 20148 bit generated KeyPair.
  44. *
  45. * @return The 2048 bit RSA KeyPair's private key.
  46. */
  47. @property(nonatomic, readonly, strong) NSData *privateKeyData;
  48. #pragma mark - Info
  49. /**
  50. * Checks if the private and public keyPair are valid or not.
  51. *
  52. * @return YES if keypair is valid else NO.
  53. */
  54. - (BOOL)isValid;
  55. /**
  56. * The public key in the RSA 2048 bit generated KeyPair.
  57. *
  58. * @return The 2048 bit RSA KeyPair's public key.
  59. */
  60. - (SecKeyRef)publicKey;
  61. /**
  62. * The private key in the RSA 2048 bit generated KeyPair.
  63. *
  64. * @return The 2048 bit RSA KeyPair's private key.
  65. */
  66. - (SecKeyRef)privateKey;
  67. @end