private-key

How to get a SecIdentityRef from a SecCertificateRef and a SecKeyRef

我的未来我决定 提交于 2019-12-12 04:07:48
问题 Here's what I've already tried: First idea was, just put both into an array, use that array with kSecUseItemList , so keychain calls will operate only on the items in this array, not on real keychains and then get the identity like this: NSDictionary * searchQuery = @{ (__bridge id)kSecClass:(__bridge id)kSecClassIdentity, (__bridge id)kSecUseItemList:@[(__bridge id)key, (__bridge id)cert], (__bridge id)kSecReturnRef:@YES }; CFTypeRef foundItem = NULL; OSStatus copyStatus =

openssl phishing : V claims to be A

怎甘沉沦 提交于 2019-12-12 03:07:33
问题 there are several components of my application, needs their communication secure in the sense Origin Verified. these components cannot share a common secret. So I have to opt for asymmetric key encryption. assuming I've two components A and B A sends some data F to B and B has to verify that it really came from A A generates digest H of F with its private Key A attaches A_pub , H to its request Parameters, sends F and declares origin/sender as A B verifies the digest H with the A_pub provided

What is the best way to encode string by public-key in python

杀马特。学长 韩版系。学妹 提交于 2019-12-12 02:09:38
问题 Is there any way to encode string by public-key? I found two packages, pycrypto and m2crypto. But I can not find how to use them. 回答1: To encode a string using public key: #!/usr/bin/env python from M2Crypto import RSA, X509 x509 = X509.load_cert("recipient_cert.pem") rsa = x509.get_pubkey().get_rsa() print rsa.public_encrypt("your string to encrypt", RSA.pkcs1_oaep_padding) 来源: https://stackoverflow.com/questions/7563732/what-is-the-best-way-to-encode-string-by-public-key-in-python

APNs certificate missing private key when generating with custom keychain

此生再无相见时 提交于 2019-12-11 14:41:54
问题 I was trying to generate a new APNs certificate for my app on our build server but when I got to the "Export 2 items" step for the Certificate and Private Key, I found that I didn’t have two items. My certificate didn’t have any private key with it. I can see in my keychain that the certificate belongs to the System keychain whilst the public and private key are in my CI-Jenkins keychain . I repeated the process on my development machine and it worked fine there. The only difference being

IIS 6 Private Key certificate access

徘徊边缘 提交于 2019-12-11 14:38:05
问题 We have a Web asp.net application running in the framework 2.0 and hosted in an IIS 6 server, and the OS is windows server 2003. The web application is suing a client certificate to be authenticated by a web service. We have impersonalized the application pool with de user “Network Service”. The problem is when we have to access to the private key of the certificate that is stored in the machine key/my storage. The user Network Service cannot access the key. We have given privileges to the

How to operate with X509 certificates in .NET code

一世执手 提交于 2019-12-11 07:19:20
问题 I have some code that needs to work with X509 Certificate information. I have downloaded a sample that does this: const string CertWithoutPrivateKey = "MII...."; const string CertWithPrivateKey = "MII..."; public static SecurityToken GetSigningToken(bool includePrivateKey) { X509Certificate2 cert = null; if (includePrivateKey) { cert = new X509Certificate2( Convert.FromBase64String(CertWithPrivateKey), "pw", X509KeyStorageFlags.PersistKeySet); } else { cert = new X509Certificate2( Convert

.NET Core X509Certificate2.PrivateKey throws nte_bad_keyset error

徘徊边缘 提交于 2019-12-11 05:47:17
问题 When trying to get a X509Certificate2 object from the X509Store using the following code: private X509Certificate2 GetKey() { try { X509Store store = new X509Store("WebHosting", StoreLocation.LocalMachine); store.Open(OpenFlags.ReadOnly); var collection = store.Certificates.Find(X509FindType.FindBySubjectName, "xxxxxxx", true); if (collection.Count == 0) { throw new Exception("No keys matched"); } if (collection.Count > 1) { StringBuilder sb = new StringBuilder(); sb.Append("More than 1 key

Converting a PEM private key file to a JAVA PrivateKey Object

雨燕双飞 提交于 2019-12-11 02:33:46
问题 I know that there are several other questions about that topic, but none of them have helped me out. I tried the BouncyCastle lib as well. Could someone please help me here? The PEM file looks like: -----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEAq2eYtnTsEc/qyqS ... ... zY3WG++SA+amcXiO721hJWNC+uTbZ1bzQ== -----END RSA PRIVATE KEY----- I'm using this method public static PrivateKey getPemPrivateKey(String filename) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException { File f

RSA_public_decrypt fails when using RSA_set0_key(key, n,e,d)?

人盡茶涼 提交于 2019-12-11 02:24:11
问题 I have the n , e , d component from other devices not the OpenSSL. I want to encrypt and decrypt using the OpenSSL API. But decrypt always fails after encrypt. I use RSA_set0_key for private key ( n , e , d ) setting, and RSA_private_encrypt is OK, but RSA_public_decrypt fails always. I wonder why it fails. Why does RSA_public_decrypt fail? 回答1: RSA_set0_key() with N, E, D is possible? Yes. RSA_set0_key is documented in the OpenSSL man pages. Its signature is: int RSA_set0_key(RSA *r, BIGNUM

Encrypt a private key with Password using BouncyCastle

99封情书 提交于 2019-12-11 02:08:27
问题 I am new to BouncyCastle. I have a private key generated using the below code. final CertAndKeyGen keypair = new CertAndKeyGen("RSA", "SHA1WithRSA", null); keypair.generate(1024); final PrivateKey privKey = keypair.getPrivateKey(); I would to encrypt it with a password using AES or some openssl supported algorithm using BouncyCastle. Can some one help me out how to start, where I am not able to find any good tutorial on this. Please help me out. Thanks in advance. 回答1: If you just want to