How does Android KeyStore encrypt keys - java

I'm curious to know how keys are encrypted when using KeyStore on android. From what I found it is using AES with some kind of master key, but haven't found more details or articles giving more info.
Do you know what is the exact process of keys encryption?

Related

Does Azure's Key Vault support PGP key encryption?

I would appreciate clarification and advice on the following:
i am working on secure file transfer using SFTP protocol. We use PGP public/private key pair for file encryption and decryption . for a time being we keep our public/private key in local system. but as per requirement we want to keep these keys on Azure's keyVault . But i didn't found any document related to import my existing PGP public/private key in Azure's keyVault.
I am confused after reading MS Azure's documentation and related blog posts, where some sources claim Asymmetric key encryption is supported, but there is no official documentation on this.
It's obviously a late response but just for anyone landing here -
Do a Base64 encoding of the PGP key's content and store the encoded string in an Azure Key Vault Secret. Just decode the key before using it for encryption / decryption.
When you use Azure Key Vault, you can import or generate keys in hardware security modules (HSMs) that never leave the HSM boundary. This scenario is often referred to as bring your own key, or BYOK. The HSMs are FIPS 140-2 Level 2 validated. Azure Key Vault uses nCipher nShield family of HSMs to protect your keys.
Use the information in this topic to help you plan for, generate, and then transfer your own HSM-protected keys to use with Azure Key Vault.
This functionality is not available for Azure China.
You can read more about it in below docs:
https://learn.microsoft.com/en-us/azure/key-vault/key-vault-hsm-protected-keys#prerequisites-for-byokTo
https://id-3.co.uk/bring-your-own-key-what-is-it-and-what-are-its-benefits/
https://youtu.be/lOpaD4vShsU
Hope it helps.

Encrypting a secret key for jenkins configuration

I'm automating a Jenkins deployment which involves using the Google Login plugin using Ansible.
This plugin encrypts the value of the secret key at rest.
After some digging I found the relevant code which encrypts secrets in Jenkins. The code uses an AES cypher and
custom serialization which appears to be base64 in a very specific format.
The encryption key is stored in a CredentialsStore (see here and here).
I'd like to provision the encryption key and the Google Apps secret key using Ansible but I'm not sure how exactly to do so.
I can write a Python module that encrypts the Google Apps secret key the same way Jenkins does but I don't understand how to read or write to the DefaultCredentialStore.
How do I store my encryption key without using the Java code?
Is there a less tedious way to do this automatically?

How to share secret key used in AES Encryption to some other Application for decryption?

I have to implement AES Encryption/Decryption having following scenerio.
There are 2 applications App1 and App2 running on different servers.
App1 will encrypt(using AES Encryption) some data and give it to App2. App2 will decrypt the same data using AES decryption. The secret key needs to be shared with App2 for decryption.So, how to share the secret key with App2 ? Can we use java keystore in this case ?
Can we use java keystore in this case?
A Java keystore file could be used to share the key data, but you would need to password-protect this file to ensure other parties cannot read the key. So you've only changed the problem to how to securely share a password.
A common way to solve your original problem is to use asymmetric cryptography. By encrypting the AES key with a public key held by your recipient, you've ensured no others can read the key data. However, you will still need a method of determining that the public key corresponds to your intended recipient. For that, most people revert to a PKI of some description.
This is a broad subject area and worthy of some further reading on your part before you determine the correct approach for your use case.
You need to implement Diffie Hellman Algo! Watch this on youtube Watch this simple youtube explanation!

Storing an X.509 certificate in a Java keystore

I am trying to store a proxy X.509 certificate into a keystore. The certificate is generated using bouncycastle library, the problem is that I do not have the secret key for the certificate and from what I understand is that to store it in a Java key store I need the secret key. Furthermore I can't seem to convert the certificate into Java's own implementation of it.
I want to store it in a keystore so that Axis2's Rampart could attach it to SOAP messages according to our own security architecture.
IF anyone can kindly explain to me if there is a way to do this or if I am missing something important I would be thankful
from what I understand is that to store it in a Java key store I need the secret key
No. You don't need the private key to store a certificate. You only need that for your own certificate. Just use keytool -import.

Use of RSA key Wrapping using MSCAPI

I am using AES Symmetric encryption of data using BouncyCastle provider, and then wrapping the key using RSA Asymmetric algorithm from Public key obtained from Windows keystore certificate using SunMSCAPI provider. Can anyone please help how to use the SunMSCAPI for RSA wrapping and unwrapping of symmetric keys appropriately with some code snippet?
[sweeping old questions]
You can just use javax.crypto.Cipher.wrap() and unwrap() using the retrieved instances of RSAPublicKey and RSAPrivateKey. For this you may need the unlimited crypto policy files from Sun/Oracle for your JDK/JRE.

Categories