-1

Diclaimer

In the first place this is a recap on recent development activities. I am writing this down for lost souls - as I could not find any post containing this error except:

The Problem

During decryption of a cyphertext with a given private key, iOS throws this error:

Optional(Swift.Unmanaged<__C.CFErrorRef>(_value: Error Domain=NSOSStatusErrorDomain Code=-50 "RSAdecrypt wrong input (err -27)" UserInfo={numberOfErrorsDeep=0, NSDescription=RSAdecrypt wrong input (err -27)}))

For the sake of readability and search engine optimization the same error is given in a style which is more easy to be read:

Optional(
    Swift.Unmanaged<__C.CFErrorRef>(
        _value: Error
            Domain=NSOSStatusErrorDomain
            Code=-50 "RSAdecrypt wrong input (err -27)"
            UserInfo={
                numberOfErrorsDeep=0,
                NSDescription=RSAdecrypt wrong input (err -27)
            }
    )
)

The Question

What are likely reasons for receiving this error?

However

My knowledge so far is given in one of the answers below ;-)

d.braun1991
  • 151
  • 1
  • 13
  • 3
    You should edit your text into a clear question, then add a separate answer to it (which I suppose is what you included as "the good news and the bad news", or perhaps is only the latter, not sure). – not2savvy Feb 10 '23 at 17:13

1 Answers1

0

As mentioned by @not2savvy, I better answer as far as known here instead of 'within the question part' ... .. .

The good news

You probaply solved several problems already, such as:

  • Base64 decoding error

    • -> In case your ciphertext/private key had to be transformed back to binary
  • Algorithm error

    • -> Mismatch of PrivateKey in regards of the needed algorithm (e.g.: RSA)
  • Size error

    • -> Mismatch of Ciphertext- and Keysize
  • Wrongkey error

Note

Be sure that you don’t generate multiple, identically tagged keys. ... .. .

... .. . you are not far from the solution ;-)

The bad news

  • You probaply have the wrong private key to decrypt the given cyphertext.

  • Something else is wrong with your key, which I do know nothing about.

d.braun1991
  • 151
  • 1
  • 13