Browse Source

Merge pull request #1060 from beatt83/fix/rsa_private_key

fix: externalRepresentation condition to validate if key is private should be d not prime
Nathan Fallet 1 tháng trước cách đây
mục cha
commit
132f5b209c
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      Sources/CryptoSwift/RSA/RSA.swift

+ 2 - 2
Sources/CryptoSwift/RSA/RSA.swift

@@ -61,7 +61,7 @@ public final class RSA: DERCodable {
   public let keySizeBytes: Int
 
   /// The underlying primes used to generate the Private Exponent
-  private let primes: (p: BigUInteger, q: BigUInteger)?
+  public let primes: (p: BigUInteger, q: BigUInteger)?
 
   /// Initialize with RSA parameters
   /// - Parameters:
@@ -388,7 +388,7 @@ extension RSA {
   /// ```
   ///
   public func externalRepresentation() throws -> Data {
-    if self.primes != nil {
+    if self.d != nil {
       return try Data(self.privateKeyDER())
     } else {
       return try Data(self.publicKeyDER())