cryptography

Decrypting EnvelopedCms with non-default AlgorithmIdentifier

爱⌒轻易说出口 提交于 2020-01-02 01:25:11
问题 I'm trying to decrypt a EnvelopedCms that was encrypted using a non-default AlgorithmIdentifier like this: ContentInfo contentInfo = new ContentInfo(data); EnvelopedCms envelopedCms = new EnvelopedCms(contentInfo, new AlgorithmIdentifier(new System.Security.Cryptography.Oid("2.16.840.1.101.3.4.1.42"))); CmsRecipientCollection recipients = new CmsRecipientCollection(SubjectIdentifierType.IssuerAndSerialNumber, certificates); envelopedCms.Encrypt(recipients); byte[] encryptedData = envelopedCms

Java Decryption - Input length must be multiple of 8 when decrypting with padded cipher

我是研究僧i 提交于 2020-01-01 20:01:26
问题 I have a project for a security course but i'm having an issue. basically , i'm trying to encrypt then decrypt a password but i'm getting this error for the decryption . "Input length must be multiple of 8 when decrypting with padded cipher" Am i doing this the right way . I was following an article from 2012 . Is it still secure ? Also i tried replacing the algorithm but nothing seems to work : "AES" , "RSA/ECB/PKCS1Padding" , "PBEWithHmacSHA256AndDESede"..and many more i get : Exception in

Java Decryption - Input length must be multiple of 8 when decrypting with padded cipher

▼魔方 西西 提交于 2020-01-01 20:01:22
问题 I have a project for a security course but i'm having an issue. basically , i'm trying to encrypt then decrypt a password but i'm getting this error for the decryption . "Input length must be multiple of 8 when decrypting with padded cipher" Am i doing this the right way . I was following an article from 2012 . Is it still secure ? Also i tried replacing the algorithm but nothing seems to work : "AES" , "RSA/ECB/PKCS1Padding" , "PBEWithHmacSHA256AndDESede"..and many more i get : Exception in

iOS symmetric key encryption / decryption equivalent to Java

梦想的初衷 提交于 2020-01-01 19:21:15
问题 I am trying to encrypt/decrypt data ios to java & java to ios but I data encrypted in java is not properly decrypted in ios & data encrypted in ios is not properly decrypted in java - (NSData *) encrypt:(NSData *) dataToEncrypt symmetricKey:(NSData *)symmetricKey context:(CCOperation)encryptOrDecrypt{ NSUInteger data_length= [dataToEncrypt length]; uint8_t input_raw_data[data_length]; //The [dataToEncrypt length] gives the number of chars present in the string.So say there are 10 chars. //Now

Verify BouncyCastle ECDsa signature with .NET libraries ECDsaCng

为君一笑 提交于 2020-01-01 19:00:49
问题 An existing system generated signatures using Bouncy Castle (.NET) and I need to verify these existing signatures using the Microsoft ECDsaCng class. Consider the following code that attempts to do this: public static void InterchangeTest() { //AsymmetricCipherKeyPair bKeyPair_0 = Crypto.GenerateEcdsaKey(); String sPassPhrase = "bob is your uncle"; byte[] bPassPhrase = new UTF8Encoding(false).GetBytes(sPassPhrase); int SaltBitSize = 128; int EcdsaBitLength = 521; byte[] bSalt = new byte

Verify BouncyCastle ECDsa signature with .NET libraries ECDsaCng

≯℡__Kan透↙ 提交于 2020-01-01 19:00:11
问题 An existing system generated signatures using Bouncy Castle (.NET) and I need to verify these existing signatures using the Microsoft ECDsaCng class. Consider the following code that attempts to do this: public static void InterchangeTest() { //AsymmetricCipherKeyPair bKeyPair_0 = Crypto.GenerateEcdsaKey(); String sPassPhrase = "bob is your uncle"; byte[] bPassPhrase = new UTF8Encoding(false).GetBytes(sPassPhrase); int SaltBitSize = 128; int EcdsaBitLength = 521; byte[] bSalt = new byte

Is there any way to use RNGCryptoServiceProvider class in C# Portable class Library

主宰稳场 提交于 2020-01-01 18:26:19
问题 I am working on a encryption algorithm and using cryptography for this. I want to make this portable, but didn't find any way to resolve this class. 回答1: You can also use the full managed Bouncy Castle Library. A Portable Class Library Patch is available here: http://www.bouncycastle.org/jira/browse/BMA-107 A pre-build of Bouncy Castle 1.7 with the PCL Patch is available here for example: https://github.com/dnauck/Portable.Licensing/tree/master/lib 回答2: You Didn't mention what profile you are

PasswordDeriveBytes(.net 2.0) for iPhone

柔情痞子 提交于 2020-01-01 17:14:30
问题 I want to use PasswordDeriveBytes(RSA PBKDF1) of .NET 2.0 within iPhone. How could i achieve the same exact implementation? Are there any methods or libraries for it? I especially want it for using a salt. Thanks 回答1: Since MS implementation is not totally following the PKCS#5 specification the easiest way would be to convert Mono (C#) source code into Objective C. That will get you very close to MS implementation (everything except a very bad bug :-). In any case I suggest you stick to the

PasswordDeriveBytes(.net 2.0) for iPhone

主宰稳场 提交于 2020-01-01 17:13:31
问题 I want to use PasswordDeriveBytes(RSA PBKDF1) of .NET 2.0 within iPhone. How could i achieve the same exact implementation? Are there any methods or libraries for it? I especially want it for using a salt. Thanks 回答1: Since MS implementation is not totally following the PKCS#5 specification the easiest way would be to convert Mono (C#) source code into Objective C. That will get you very close to MS implementation (everything except a very bad bug :-). In any case I suggest you stick to the

Are there javax.smartcardio analogues on Android?

一曲冷凌霜 提交于 2020-01-01 12:22:55
问题 Are there javax.smartcardio analogues on Android? but not using Open Mobile API. Thanks! 回答1: I'm using javax.smartcardio.* as a facade to IsoDep on Android in a project called SCUBA. Note that this is for trancieving APDUs to ISO14443 cards in the field of the NFC chip (in NFC capable Android phones), and not for communicating with SIM or SE. (Main motivation was to be able to use the same JMRTD ePassport reading API jar both on J2SE and Android without changes.) EDIT: If you're interested