© 1996-2017 2008-07-30 Roedy Green of Canadian Mind Products certificate menu How Certificates Work A certificate is just a file, digitally signed by a signing authority. It may be a freestanding file, pure or American Standard Code for Information Interchange. Usually it lives inside an container file called a keystore. Your personal certificates are kept in a file called. Make sure you back up your. Otherwise you will lose your code signing certificates. It contains two parts, a private part only you know and a public part the world knows. You use it to stamp your work proving you authored it and that it has not been tampered with. To verify a signature, you need only a certificate from the root signing authority installed in your certificate repository. These root certificates are typically pre-installed at the factory in browsers. You must get that separately. Certificates are primarily concerned with digital signatures, though they can be used for encryption. Certificates contain your public keys so that other people can encrypt the mail they send you so that if anyone intercepts it, they cannot make any sense of it. You can safely hand out your public keys to others since they do not contain your private keys. You must be very careful not to let others discover it. The certificate-issuing authority at no time is privy to your private key. Your browser generates your random private key when you purchase your certificate and sends only the public key to the certificate authority. You need passphrases for your browser and for each certificate. If you forget a passphrase, you are totally hosed. You will never be able to use the certificate again. Thankfully, some certificates offer a hint which you compose in case you forget the passphrase. For a technical overview of how the public and private keys work, see my. The Types of Digital Certificate There are many different types of certificate. Secure Sockets Layer web server, SSL web browser Opera, Internet Explorer… , SSL Extended Verification Secure Socket Layer , software publisher jar signing sometimes called Object-signing in three flavours: Microsoft Rivest, Shamir and Adelman Authenticode, RSA X. Why are the re so many types? It is partly marketing. The more types there are, the more certificates the vendors can sell. The certificate authority has to do research to vouch for the truth of certain information in the certificate. That you are indeed whom you claim to be, or that you are authorised to sign code for company that does exist. That you own a domain. That a particular company owns a domain and that company exists. That the company has a good reputation and institutes good security practices. The CA has to do almost no work for a mail certificate. That is why they are often free. They can charge thousands of dollars for a premium SSL certificate. Unfortunately, all this innovation and competition leads to a tower of Babel. It is not always obvious what scheme an incoming message is using. Further, most of the time the certificate file looks like gibberish. You need to keep track of that externally. Security software is typically not in the least user-friendly. It is designed for nerds. For example, if you feed an X. To complicate matters further, certificates can come an a variety of packagings called wrappers. For example, Public- Key Cryptography Standards 12 wrapping allows key portability. This means, for example, that you can move your certificates and the corresponding private keys from one computer to another on floppy disks. Thawte RSA certificates come with PKCS 7 wrappers. Just when you thought you understood it all, you learn that X. PKCS 11 cryptoki is used inside for identification and decryption. Here are some of the common types: Various types of certificates and their properties including extensions. Types of Certificate Extension Format Includes private key? Netscape Opera Internet Explorer Java Plug-In keytool 1. Sometimes a chain of certificates. Sun Java version 1. CRL Certificate Revocation List. Netscape export of the entire set of keys. Contains multiple certs with private keys. Can optionally include private key, authentication chain and friendly name. Can optionally include private key, authentication chain and friendly name. Can optionally contain multiple certs, e. Looks like a signed document without content. Your signed certificate back from the signing authority ready to import. Windows certificate trust list. What matters in the internal format of the file. The file formats are nearly all missing a format signature to make identification easy. It is as though the designers did not want anyone looking at the files and making any assumptions on what they read there. You must externally track what every certificate is for. We need software that can handle multiple schemes depending on the automatically determined preferences of the recipient. We need to have viable alternatives waiting in the wings. Some certificates have binary format, others an ASCII printable format, still mostly gibberish. ASCII format are often called armoured. Signing XML requires canonicalisation to put the document in standard format, then computing a digest and embedding it in the document. Cost Certificates vary in cost depending mainly on how much research the certificate authority does to verify you are really you and how much information is in the certificate that the authority is attesting is true. Unfortunately, Verisign bought out Thawte in 2000-02, so prices will likely gradually rise. With Verisign you need to buy three separate certificates. Thawte has greatly improved over the last year and issued my certificate within one day after I faxed the necessary documentation. Thawte is in South Africa. Verisign is in the USA. Your secrets are probably better kept by a different government than the one wanting to pry on them. All it would take is a court order to discover your Verisign secrets. Thawte has better documentation. There has been a historical tendency of certificate companies to presume extremely high technical knowledge on the part of their users. It is not quite as bad as you might think since, in theory, the signing authority does not know your private key. Personal certificates are often free, especially ones with a short expiry date. Corporate ones are hundreds of dollars per year. What Certificates Do you Need? What Is in A Certificate? All the ones you download do not contain a private key. The information is not in human-readable form. You need a program to decode and display it. You may be required to provide additional information such as Business License, Certificate of Business Registration and Articles of Incorporation which are kept on file at the signing authority, but which are not included in the certificate as vouched for information. None of this information has any effect on how and where you can use your certificate. Some certificates may have a lifetime of only minutes. The signing authority is guaranteeing the information is true. They use their private key to sign the certificate attesting to its authenticity. What Can You Use Certificates For? You can then use the certificate to digitally sign email, documents, jar files etc. You can also use some types of certificate as digital ID. Others can electronically challenge you to prove you know the private key that fits with the public key in the certificate by encrypting a message they provide. The problem with that is, all the information in the certificate is revealed to whoever you show it to. If you want to selectively reveal information, you need several certificates. You might want one with just your birthdate for entry to pornsites, but no other information. You might want one that revealed only a very minimal amount of information when dealing with online vendors to avoid being bombarded with junk electronic and snail mail. Certificates can be used instead of passwords to verify who you are to some site. The site challenges you by sending you a message that you digitally sign and send back. If some spy had snooped on you logging in before, it would not help him to spoof you, the way it would had you used a password. Other types of certificate allow you to encrypt and sign all Hyper text Markup Language traffic leaving your web server, thus proving it came from you and providing privacy. Recipients can determine whether data did indeed did come from you by checking the digital signature. To verify, all they need is a master certificate from the signing authority, which comes built into their browser or email software. MasterCard and Visa have designed the SET certificate that can be used for secure financial transactions over the web. Verisign supplies the certificates. Sun style user certs never do. You want to avoid passing your private keys around, even for phony certs. When you use a phony cert, you want just the public key installed as a signing authority in the various browsers that will use your signed code. The problem is when you export and import keys, it is rarely clear on whether the private key is being included. Internet Explorer is fairly good about keeping you informed and giving you the option to include or exclude the private key. Opera keeps you in the dark. See my to rectify this problem. Viewing Certificates: What Certificates Do You Already Have? You already have many certificates installed on your computer. Some are part of the OS, some part of Java and some part of each browser. Some are public keys of signing authorities, some are your personal private key certificates. Here is how to have a look at what you already have. Where to look for certificates in various browsers both in the menu system and on hard disk. Use or to view them. In Java version 1. Opera stores its certificates in opacert. I have not been able figure out where Internet Explorer hides its certificates, possibly somewhere in the registry. When you export from IE, you have the option of including the private key. I have not been able figure out where Internet Explorer hides its certificates, possibly somewhere in the registry. When you export from IE, you have the option of including the private key. I have not been able figure out where Windows hides its certificates, possibly somewhere in the registry. What Certificate is a Site Using? You can find out what SSL certificate a site is using with Firefox or Opera by clicking the icon to the left of the URL, with IE and Safari click the lock icon to the right to give you certificate details. Chrome no longer lets you view the certificate. You need a in the chain in your store for that certificate to work. You can also get more detailed information from the Where are Certificates Stored? You can manage your certificates with. You can manage your certificates with. There is no way to recover it. You would have to start over and create a new empty. They send you a copy of the public key when you establish a connection. You do not maintain a permanent copy, just a copy of the corresponding root certificate. IE, Chrome, Safari, iTunes and Outlook all use this collection. You can use certmgr. You can get more certs for Opera at. These are not root certificates that Opera issues, but rather root certificates Opera has collected from certificate authorities that are not included in the distribution, but which they recommend for inclusion if needed. Use the 03 folder. The 02 is an older format. You could add them to any browser. Opera stores its certificates in a proprietary way and offers no Application Programming Interface for programs to access it. The moral of the story is, when you import a root certificate, you must import it into multiple certificate stores. Because different browsers have different libraries of certificates, different SSL sites and different signed Applets will work with each browser. The procedures to use security measures are still quite complicated and easily screwed up. A dutiful user will mindlessly provide them. Crack them and replace crucial bits of code in browsers or signing tools. Obscure Certificates There is a third kind of certificate, legitimate like one from Thawte or Verisign, but with most of the hassle of a phony one. What if you bought your certificate from a small signing authority company that almost no one had heard of, or used a free one, its root certificate would not be built into Internet Explorer. This would be a major hassle if you are dealing with the general public. This problem even happens sometimes with mainstream companies. For example Thawte sold code-signing certificates in 2004-04, but the root certificate to verify them was not present in Java Development Kit 1. It had to be manually installed, making using the certificate as clumsy as a phony self-signed certificate. How Java version 1. The scheme strikes me as impractical since most end users will be incapable of maintaining policy files. It really only makes sense in a corporate environment with a system administrator who manages all policy files. RuntimePermission usePolicy in their local policy file. There is no way with Java 1. However, once the usePolicy is in place, applications may use the javax. It sounds hideously complicated involving, authenticated Subjects, Principals, AccessControllers, PermissionCollections and Permissions. Fine grain policies where you ask the use for permission are pointless because the user does not understand the questions. Further, the many questions just irritate him. I have little to say about it other than my documentation on how to use. I asked in a newsgroup for an explanation of what AccessControllers were for. Hold your breath, here was the response. The Java AccessController uses the set of ProtectionDomains on the call stack to implement permissions based on code bases e. When you check for a permission, the AccessController examines each ProtectionDomain on the call stack in the AccessController, ensuring that the associated PermissionCollection for each such ProtectionDomain implies the requested permission. Java Authentication and Authorisation Service authorization is implemented this way, by attaching a javax. SubjectDomainCombiner to the AccessControlContext created in javax. Then with JDK 1. Then with Java version 1. Thawte now sells only RSA-style Java version 1. If you create a self-signed certificate and choose DSA, it will work on JDK 1. If you create self-signed RSA certificate will work only on Java version 1. Pretty much all certificates are RSA now. Whether you choose DSA or RSA, the SHA-1 digests in the MANIFEST. For reasons unknown, the SHA-1 digests in MANIFEST. DSA member of the jar. RSA member of the jar. Manipulating Certificates You can manipulate certificates directly with Java. Here is an example of how you would extract the public key from a PKCS12 certificate. Certificate Expiry According to Thawte, you can buy a code-signing certificate from them, valid for one or two years. You can sign code for one or two years, then the certificate stops working. However, the code you sign stays valid up to ten years. You get to choose how long you want it to remain valid when you do the signing. More and more websites are refusing to update their expired SSL certificates. If you want to see the content, you have to override the expiry. This is defeating the whole point of expiry dates. However, the bright side of this is it should force down the cost of renewed certificates which should be cheaper for the certificate authority to research. It is a blinking nuisance though for link checking. Learning More See for notes on how to create your own certificates you as issuing authority , for Netscape, IE and Java 2. HttpsURLConnection is as subclass of HttpURLConnection that URL. The classes often come to the rescue. It is a surprisingly easy to follow book. The JCE itself is daunting, but this book tames it with lots of code examples and an informal style. Consider this book an introduction to the JCE, not the final authority on high security. The book, is inconsistent in its intended audience. Yet near the end of the book, the authors throw an alphabet soup of undefined terminology at you as if you were a roomful of Verisign techies. Online bookstores carrying Digital Certificates: Applied Internet Security Greyed out stores probably do not have the item in stock. Try looking for it with a.