ios self signed certificates - iphone

Is there a way to create a self signed certificate from your own ios application?

Is this more what you're after?
How to use NSURLConnection to connect with SSL for an untrusted cert?

Certificate configuration:
You have to install the Self Signed Certificate or CA on the device in order for the device to trust it
then only device trusts the SSL connection.
In the case of installing self signed certificate make sure domain name of the URL is same as Common name of certificate.
If there is no domain name then IP address is fine.
Certificate installation:
You can just host it on the web server and try to access it from safari then iOS will prompt for the certificate installation in the iOS Device
Certificate Creation:
Here is the way to create self signed certificate so that you can fill all the details and host in web server.
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 1001 -nodes
(Pay attention while entering the value for Common Name)

Related

SSL Certificate Not Being Recognized On Mozilla Firefox (MAMP Server)

I’m currently using an SSL certificate on a MAMP server that I made myself via OpenSSL. I’m running the MAMP server on an Apple Mac that’s running Monterey 12.4. I have no problems running the website that I’ve created via the MAMP server with the SSL certificate I created on any web browser except Mozilla Firefox. I’ve tested every other browser and my website runs without any issues whatsoever.
On Mozilla Firefox, I’m getting an error message that indicates a security risk, and at the bottom of the error message reads “SSL_ERROR_BAD_CERT_DOMAIN”. When I type www. In front of the website URL, for whatever reason, the site runs without any issues on Mozilla Firefox.
Could this issue on Mozilla Firefox be resolved if I created a 2 way SSL certificate that included my website's name with www. in it? If so, how could I go about creating a 2 way SSL certificate? If anyone knows how to solve this issue, I’d greatly appreciate you sharing your knowledge with me.
Listed below is the method I took to create an SSL certificate via OpenSSL. If any step in this is incorrect or a further step needs to be added, I’d much appreciate sharing the correct steps with me.
- openssl genrsa -des3 -out local-ca.key 2048
- openssl req -x509 -new -nodes -key local-ca.key -sha256 -days 365 -out local-ca.pem
Country Name (2 letter code) []:
State or Province Name (full name) []:
Locality Name (eg, city) []:
Organization Name (eg, company) []:
Organizational Unit Name (eg, section) []:
Common Name (eg, fully qualified host name) []: www.mywebsite.com
Email Address []:
- openssl genrsa -out server.key 2048
- openssl req -new -key server.key -out server.csr
Country Name (2 letter code) []:
State or Province Name (full name) []:
Locality Name (eg, city) []:
Organization Name (eg, company) []:
Organizational Unit Name (eg, section) []:
Common Name (eg, fully qualified host name) []: www.mywebsite.com
Email Address []:
- openssl x509 -req -in server.csr -CA local-ca.pem -CAkey local-ca.key -CAcreateserial -out server.crt -days 365 -sha256 -extfile v3.ext
The contents of the vs.ext file:
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = #alt_names
[alt_names]
DNS.1 = www.mywebsite.com

Apache NiFi with MongoDB over SSL

I've faced the problem with SSL connection to MongoDB (SSLContextService processors).
all certificates I've generated (Root, Server and Client). Server and Client certificates I've signed with my root certificate. Since my MongoDB-Sever has more then one IP-Address, I've include all IP-Addresses in the server certificate.
MongoDB is also configured for ssl connections (tls), the old version of tls (1.1, 1.2) are not disabled in MongoDB.
SSL-Connection with mongo-shell works without problems. I've also checked everything with openssl s_client and connection was there and also worked properly.
For Apache NiFi I've created keystore (PKCS12)
openssl pkcs12 -export -name client -in client.crt -inkey client.key -certfile ca.crt -out client.p12
and also truststore with server certitiface
openssl pkcs12 -export -name server -in server.crt -inkey server.key -out server.p12
and I've also tried
openssl pkcs12 -export -name server -in server.crt -inkey server.key -certfile ca.crt -out server.p12
ca.crt is my root certificate. client.crt and server.crt were sigend with this ca.crt.
I've used both services in NiFi:
StandardSSLContextService and StandardRestrictedSSLContextService. In the parameter Keystore I've put client.p12 and in truststore parameter server.p12. Both types PKSC12. TLS protocoll just TLS.
But anyway I get an error "PKIX path building failed".
I'm not sure what I've missed, but may be someone had such problem already.
Thanks in advance.
P.S. forgotten:
If I set in MongoDBControllerService parameter "Client Auth" to "NONE" then it works.
PKIX path building errors mean that NiFi cannot construct the trusted "path" between the certificate that is presented by the other endpoint (in this case MongoDB) and any of the certificates which are loaded in the respective truststore to identify trusted certificates.
If I am watching my niece tells me she's allowed to have all the candy she wants, I am not likely to agree. However, if she has a signed note from her parent confirming that, she gets candy. If she has a note signed by herself in crayon, not so much.
The likely solution is to concatenate the root public certificate and the node certificate into a single file (literally just cat server.pem ca.pem > combined_server.pem; make sure the node cert is first). That command assumes the certificate files are in PEM-encoded ASCII format (i.e. starts with -----BEGIN CERTIFICATE-----) and I prefer using .pem for the extension here, though .crt files can also contain this data. You can then verify that the chain is correct with
openssl verify -verbose -purpose sslserver -CAfile ca.pem combined_server.pem
For consistency, I'd repeat the process with the client cert and CA as well (use -purpose sslclient in the verification command). Then regenerate the PKCS12 keystore & truststore and load them into NiFi.
I am slightly confused by the fact that you say disabling client authentication in NiFi allows this to work, as NiFi should be acting as the client, and clients don't get to determine the client authentication level (the setting is literally ignored when acting as a client). It should only matter if NiFi is somehow acting as the server and MongoDB is the client. What version of NiFi and MongoDB are you using?
NiFi uses its own truststore which is either jks or pfx (p12) format, not concatenated pem files and not system files under /etc/pki/ca-trust/. As far as I can tell, you are not allowed to pass the tlsCAFile url parameter from a nifi processor which is confusing.

Not able to import client certificate in Swift XMPP client

I tried to use client certificate for authentication using swift XMPP client but not able to select certificate, although I already import certificate in Window client certificate.
Got below message from the client, click ok to continue exit the window certificate dialog.
You need to install certificate first in the OS then the list will show installed certificate in the system.
To install certificate create pfx certificate formate and double click to install the certificate.
To create PFX
openssl pkcs12 -export -out my_certs.pfx -inkey example.com.key -in example.bundle.pem -certfile ca.pem

What does ssl.client.auth specify?

Does setting ssl.client.auth=required mean that the client's certificate has to be added to the kafka truststore?
Regards,
Yash
Setting ssl.client.auth=required means that clients will need to pass SSL/TLS client authentication which is based on the truststore.
The truststore should contain certificates of trusted certification authorities. So if your clients use signed certificates, you should put the certificate of this certification authority into the truststore. That would allow all clients who have a certificate signed with this CA to authenticate.
If you use self-signed certificates or if you want only selected signed certificates to authenticate, you can put directly their certificates into the truststore. But they will be treated as trusted CAs - so if the client uses its client certificate as a CA and sign more certificates, these will be also able to authenticate. So this is not completely secure.

Updating public cert with the signed cert

I have a CA pairkey and I need to sign a client pairkey for client authentication. I am using keytool for this. Based on this I have created a .p12 pairkey for my client. Then I create a CSR and then I sign it to have a .cer file.
My problem is that I want to "update" the cert in the p12 with this signed certificate. Basically, I need to import the keypair into the Personal Certificates for client authentication, but Windows will accept the p12 (which is not signed) and not the .cer (since it has no private key).
How can I update the p12 with the new signed public cert? Thanks.
NOTE: I prefer not to have any intermediate cert and I don't want to use OpenSSL, I need to use keytool
EDIT - By the way, when I try to import the signed certificate into the .p12 I get a keytool error: java.lang.Exception: Failed to establish chain from reply
EDIT - This link and this link seem to address my problem, but it is using OpenSSL and other tools, not keytool.