RTCCertificate.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright 2018 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #import <Foundation/Foundation.h>
  11. #import "RTCMacros.h"
  12. NS_ASSUME_NONNULL_BEGIN
  13. RTC_OBJC_EXPORT
  14. @interface RTC_OBJC_TYPE (RTCCertificate) : NSObject <NSCopying>
  15. /** Private key in PEM. */
  16. @property(nonatomic, readonly, copy) NSString *private_key;
  17. /** Public key in an x509 cert encoded in PEM. */
  18. @property(nonatomic, readonly, copy) NSString *certificate;
  19. /**
  20. * Initialize an RTCCertificate with PEM strings for private_key and certificate.
  21. */
  22. - (instancetype)initWithPrivateKey:(NSString *)private_key
  23. certificate:(NSString *)certificate NS_DESIGNATED_INITIALIZER;
  24. - (instancetype)init NS_UNAVAILABLE;
  25. /** Generate a new certificate for 're' use.
  26. *
  27. * Optional dictionary of parameters. Defaults to KeyType ECDSA if none are
  28. * provided.
  29. * - name: "ECDSA" or "RSASSA-PKCS1-v1_5"
  30. */
  31. + (nullable RTC_OBJC_TYPE(RTCCertificate) *)generateCertificateWithParams:(NSDictionary *)params;
  32. @end
  33. NS_ASSUME_NONNULL_END