My requirements:
Requirement 1: Share the Java server.
Steps:
Requirement 2: Keep public key sent using java server.
1-2 1, , SecKeyWrapper ( CommonCrypto):
- (void)generateKeyPair:(NSUInteger)keySize
1: , java-?
getPublicKeyBits , NSData, - googling , DER.
getPublicKeyBits
2: NSData , , , ByteBuffer, , android, ?
3: ?
, :
№1:
Android End
iOS End
:
- RSA
№ 2: ( , - https://github.com/superwills/iOSRSAPublicKeyEncryption, iOS , , )
SecKeyWrapper * secKeyWrapper = [SecKeyWrapper sharedWrapper]; SecKeyRef PublicKey = [secKeyWrapper getPublicKeyRefFromDerCertificate: kCertificatePath]; NSData * dataToBeEncrypted = [kStringToBeEncrypted dataUsingEncoding: NSUTF8StringEncoding]; NSData * encryptedText = [secKeyWrapper wrapSymmetricKey: dataToBeEncrypted keyRef: receivedPublicKey];
NSData base64encoded string
| openssl rsautl -decrypt -inkey rsaPrivate.pem
- rsa: RSA_EAY_PRIVATE_DECRYPT: , Len:/SourceCache/OpenSSL098/OpenSSL098-47.1/src/crypto/rsa/rsa_eay.c
?
, . , , , 64 ( ----- BEGIN/END PUBLIC KEY ----- header/footer), , . , , Base64, . , ( , base64, Android, iOS , - ). , (getting error - too much data for RSA block), , , , . RSA , , , , . , , - , / , , , RSA. RSA.
getting error - too much data for RSA block
, , , , , , ( , , , , - ).
Source: https://habr.com/ru/post/1540347/More articles:How to change an individual square color in relation to music per beat continuously to create an iPhone visualizer? - iosJavaScript undefined variable detection: typeof === "undefined" against double exclamation - javascriptДоступ к BPM-поле в песне (MPMediaItemPropertyBeatsPerMinute не работает) - iosФорма Rails с подмножеством has_many: через флажки - rubymongoose: how to insert one subdocument - not an array - node.jsCorner array with indexed objects - javascriptPause and resume does not work in scrapy project - pythonКак преобразовать List в список в С# - c#Prestashop: отображение категорий дерева в бэк-офисе модуля - phpSpring Social Integration - javaAll Articles