Open diascov opened 6 years ago
@petrishenkoS @Negative3131 Thanks for opening an issue! Sorry about the delay too.
I'm not sure whether sending raw modulus & exponents is common practice but I haven't seen this used in the wild so far, and the apple SDK doesn't seem to offer such a functionality. I'm open to contributions that would add this ability, just tag me on the PR.
In the meantime, I would recommend sending keys in a PEM format (which is just DER but base64 encoded). This is perfect for http transfers since you can send a string representation as opposed to binary data.
At present, it is necessary to use index and modulus to generate public key. Swift has not found a suitable solution at present.
so how to solve this issue of asn1parsingfailed, please help
Hi there!
First of all I would like to say I'm new in programming so maybe I could ask some weird q =D
I would like to generate Public Key with data made with public key modulus and exponent.
let modData = modulus.data(using: .utf8)! let expData = exponent.data(using: .utf8)! let dataArray = [modData, expData] let publicKeyData = NSKeyedArchiver.archivedData(withRootObject: dataArray)
publicKeyData - is data for encryption as I read from java and C# examples.
my q is why I'm receiving this error from : try PublicKey(data: publicKeyData) SwiftyRSA.SwiftyRSAError.asn1ParsingFailed same with base64encoded Data
I could create Public Key only from Der or Pem files created from openssl commands to send public key to another users. But how can I manage received public key from server and create SecKey to encrypt password string?