Last updated 2004-06-28 by Roedy
Green ©1996-2004 Canadian Mind Products
Java definitions: 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
You are here : home : Java Glossary : C words : certificate.
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 don't need to install a copy of the signer's certificate.
The signature consists of a digest of the material signed, an encryption of the digest using the signer's private key, the signer's name and public key, and the signing authority's name. You could not trust a signing authority's public key embedded in the signature. 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. Unfortunately, Netscape includes your private key whenever it exports a certificate. 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. The process of purchasing a certificate may require installing the certificate authority's public key in your browser, three visits to the certificate authority's website, and some email. Depending on the cost/class of the certificate, the certificate authority may need a substantial amount of time to check you out before issuing the certificate.
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 essay on digital signatures 2004-06-28.
| Company | Types of Certificate Sold |
|---|---|
| Baltimore | SSL per year, to renew, PKI unicert |
| BelSign (Belgium) | personal email certificates(free), Netscape jar signing( /year), Microsoft Authenticode( /year), SSL or TLS Server( /year) |
| BT TrustServices (British Telecom) | Verisign SSL server certificates , email and British Government services , PKI, Verisign Go Secure for Lotus Notes and Microsoft Exchange, Identrus PKI. |
| Certum | A Polish company offering over a dozen different types of certificate including code signing certificates. Code signing certificates are free for anyone involved in an open-source project. They also offer a free timestamping service to provide undeniable proof that digital data were not modified or backdated. Prices are higher than previously, e.g. for a code-signing certificate. See the pricelist. |
| Cren | Institutional Certificates, e.g. entire universities. Cost is per institution based on size. |
| CyberTrust (USA) | out of business. |
| Entrust (USA) | personal email certificates(free), Netscape jar signing(free), Microsoft Authenticode(free), SSL Server(free), VPN [Virutal Private Network] (free), SET (free). Free certs are 60-days for testing only. To use them you must first load the Entrust root authority cert into your browser. |
| Equifax/GlobalTrust. | SSL Server ( /year) |
| GlobalSign | personal email certificates(free), Netscape jar signing( /year), Microsoft Authenticode( /year), SSL or TLS Server( /year). These people use proprietary names for their certificates which makes it difficult to figure out which one you need. |
| Keywitness (Canada) | bankrupt |
| QualitySSL, neé InstantSSL | 128-bit SSL certificate per year. |
| netborge née KMD-CA. (Denmark in Danish). | The Opera browser supports this company. The site is in Danish. They produce
four types of certificates:
|
| PGP Pretty Good Privacy/McAfee (USA) | Certificate server software you install issues PGP certificates. |
| SuperCert Hosting | SSL ( /year) sell Thawte-based certs. |
| TC Trust Center (Germany in German). | personal email certificates, Netscape jar signing, Microsoft Authenticode, SSL Server, PKCS #11: Cryptographic Token Interface Standard, root trusted authority certs for your browser. |
| Thawte Certification (South Africa). | I like Thawte. They are friendly and co-operative. Personal email
certificates(free), combined Netscape jar signing, Microsoft Authenticode and
Java Plug-in versions 1.1, 1.2, 1.3, 1.4+,(
/year,
to renew), Read the overview of: Thawte
Developer Certificates. There it states:
Thanks to some wizardry in our development team a single Thawte Developer Certificate can now be used for software signing on different platforms and in different applications. This is salesmen's hyperbole. The truth is more complicated. For Developer Certificates, make sure you use Internet Explorer and request an Authenticode certificate. It can later be converted to the others. If you accidentally bought a Netscape certificate instead, all it not lost. It can be converted to an Authenticode one. Just export to PKCS #12 *.p12 format and import into Internet Explorer, or vice versa. If you bought one of the other types, you are out of luck. there are four types of code signing certificates:
You can't interconvert Sun keytool certs to PKCS #12 because keytool refuses to either export or import a private key. It uses the same format for public certs. You can get around this restriction with tools from third parties e.g. BouncyCastle.org. Download one of the providers. You want to do this so you can import your full certs into other signing tools, like Netscape jarsigner. See Mitch Gallant's notes on exactly what to do. Basically you configure a little java program called BCMain to export the certificate in PKCS12 format using the BouncyCastle JCE. That exported file contains both private and public key. From there, you can import it elsewhere e.g. with keytool.exe.
You can use a Netscape signing certificate for The Java plug-in 1.1 and 1.2, if
you use the old Netscape RSA jar signing tool. For Java 1.3+, you need a
separate RSA certificate. They no longer make Sun DSA-style certificates. This
means another
! The Thawte website is ambiguous about this, saying it requires a different
type of certificate, but not that it requires a totally separate application
process and fee. The fault lies not with Thawte, but with Sun, since Sun's
keytool refuses to import or export private keys from the .keystore
file.
|
| VeriSign (USA). | Dealing Verisign is like dealing with IRS bureaucrats, very cold and
businesslike. They are more set up to deal with large corporations than
individual developers. Their website is well organised so you can quickly find
the certificates you need and the prices. They offer personal email certificates(
/year), Netscape jar signing (
/year), Microsoft Authenticode(
/year), Java Plug-in versions 1.1(
/year), 1.2(not available) and 1.3+
/year), Visa SET. Verisign offers 6+ types of code signing certificates. They
cannot be converted into each other. You have to buy multiple certificates if
you need more than one type.
|
The Verification feature in the Netscape Communicator Security Advisor only determines whether a Digital ID is valid for S/MIME email. Object Signing (i.e. jar signing) certificates are (usually) not also valid S/MIME certificates. It can be alarming to have your new jar signing certificate rejected without an explanation as to why. Netscape has stated this interface will be fixed in a later release of Communicator.
Unfortunately, all this innovation and competition leads to a tower of Babel. When you want to send a message to someone else, you both must be using compatible encryption/signing software. PGP is not compatible with S/MIME email for example. It is not always obvious what scheme an incoming message is using. Further, most of the time the certificate file looks like gibberish. You can't tell just by looking at the file with a text viewer, which signing authority created it, who owns it, what program is needed to make sense of it, which browsers/emailers/newsreaders it works with or even whether the file includes a private key. 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.509 v3 SHA-1 certificate to browser that only supports X.509 MD5, it will complain the file is "invalid or corrupt", instead of telling you what sort that certificate is, and what kind it wants, and where to get one.
To complicate matters further, certificates can come an a variety of packagings called wrappers. For example, PKCS #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. Your private key and passphrase are encoded in the *.p12 file. Thawte RSA certificates come with PKCS #7 wrappers. Just when you thought you understood it all, you learn that X.509 certificates come in two formats and to add further complication, they have RSA and DSA variants. Here are some of the common types:
| Extension | Format | Includes
private key? |
Netscape 4.79 | Opera 7.21 | Internet
Explorer 6.0.26 |
Java
Plug-In keytool 1.3+ |
Notes |
|---|---|---|---|---|---|---|---|
| .asc | PGP | no | no | no | no | no | Pretty Good Privacy. |
| .ca | X.509/DER binary format | no | yes | yes | yes | yes | root certificates. |
| .cer | X.509/DER binary format | no | yes | yes | yes | yes | Sun Java 1.3+ user certs. |
| .cer | X.509/DER BASE64 encoded | no | yes | yes | yes | yes | Sun Java 1.3+ user certs. |
| .crl | ? | no | ? | ? | ? | ? | Certificate Revocation List. Used by cryptext.dll. |
| .crt | X.509/DER binary format | no | yes | yes | yes | yes | Thawte root certificates, Sun Java 1.3+ cacerts. |
| .csr, .p10 | PKCS #10 | no | ? | ? | ? | yes | Certificate request, contains the public key, signed with the private key. |
| .db | proprietary binary? | yes | yes | no | no | no | Netscape export of the entire set of keys. Contains multiple certs with private keys. |
| .keystore, cacerts. | JKS | yes | yes | no | yes | yes | Sun's keyring format. Can optionally include private key, authentication chain and friendly name. Sun never imports/exports the private key, though .keystore contains it. |
| .p12, .pfx | PKCS #12 | yes | yes | no | yes | yes | user certs. Can optionally include private key, authentication chain and friendly name. Sun never imports/exports the private key, though .keystore contains it. IBM's Keyman will create and manage this format of keyring. |
| .p7b | PKCS #7 | no | no | no | yes | yes | IE binary public key export. Can optionally contain multiple certs, e.g. a certificate chain. IBM's Keyman will create and manage this format of keyring. |
| .p7r | PKCS #7 | no | no | no | yes | yes | Certificate request response. Your signed certificate back from the signing authority ready to import. ASCII format. Used by cryptext.dll. |
| .pem | PEM | no | ? | yes | ? | yes | Privacy Encoded Mail format for sending certs embedded in email, typically SSL cert. |
| .sst | ? | yes | ? | ? | ? | ? | Windows certificate store. |
| .stl | ? | no | ? | ? | ? | ? | Windows certificate trust list. Used my cryptext.dll. |
| .usr | X.509/DER binary format | no | yes | yes | yes | yes | user certificates. |
We need software that can handle multiple schemes depending on the automatically determined preferences of the recipient. However, it is a Good Thing TM there are so many schemes. Not only does it complicate the code-breaker's task, a breakthrough can render an encryption technique void overnight. We need to have viable alternatives waiting in the wings.
Some certificates have binary format, others an ASCII printable format, still mostly gibberish. Unfortunately they don't have human readable markers in them to tell you what type they are or what they are for or what they contain. ASCII format are often called armoured.
Personal certificates are often free, especially ones with a short expiry date. Corporate ones are hundreds of dollars per year. For SSL server certificates, or Developer Object/Applet signing certificates, you want to choose a certificate authority already built into the standard browsers such as Netscape, Internet Explorer and Opera, e.g. Thawte.
The certificate has an issue and expiry date. It does not contain your private key. 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.
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 HTML 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. They don't need to check up your key in an online database unless they want to check to see if the certificate has been revoked.
MasterCard and Visa have designed the SET certificate that can be used for secure financial transactions over the web. Verisign supplies the certificates.
If you are passing a certificate to another machine to sign code with, then your exported/imported certificate must contain the private key, or you won't be able to sign code, just verify it.
| Where To Look For Certificates | ||
|---|---|---|
| Browser | Where to Look In the Browser | Where to Look on Disk |
| Java stores its code signing certificates in a WINNT\Profiles\ Administrator\.keystore file and the verifying authority root certs without private keys in the J:\j2sdk1.4.2_04\jre\lib\security\cacerts file. Use keytool or keyman to view them. | The Java plug-in stores its code signing certificates in a WINNT\Profiles\ Administrator\.keystore file and the verifying authority root certs without private keys in the J:\j2sdk1.4.2_04\jre\lib\security\cacerts file. In JDK 1.3 the plug-in ignores the root certificates in the Microsoft cryptoAPI certificate database (IE browser store). In 1.4 it looks only in cacerts. In 1.5 it optionally looks in the browser certificate database as well as cacerts. | |
| Click tools | security | manage certificates. | Opera stores its certificates in opacert.dat and opcert.dat. | |
| Click edit | preferences | privacy & security | certificates | manage certificates. | Mozilla stores its certificates in C:\Documents and Settings\ Administrator\Application Data\Mozilla\Profiles\ username\. | |
| Click edit | preferences | privacy & security | certificates | manage certificates. | Netscape 4.79 stores its certificates in *.db
files. It exports them (with private keys!) to *.p12
files.
Netscape 7.1 looks in \program files\netscape\users\username. |
|
| Click tools | Internet Options | Content | Certificates. | I have not been able figure out where Internet Explorer hides its certificates, possibly somewhere in the registry. It exports them to *.pfx or *.p12 files. When you export from IE, you have the option of including the private key. | |
| Windows | Click start | control panel | Internet Options | Content | Certificates. | I have not been able figure out where Windows hides its certificates, possibly somewhere in the registry. |
If you don't have the corresponding signing authority root certificate in your browser, your browser will treat bought certificates with the same disdain it treats self-signed phony ones.
For Thawte, you can download a complete zipped collection of Thawte root certificates in three different wrapping styles. JDK 1.5 beta inadvertently left out the root Thawte code signing root certificate. You need to import it into all the cacerts files on machines using your cert.
Verisign don't let you directly download the certificates. You must go to your browser manufacturer and ask them. However, you can visually verify the certificate fingerprints.
Happily upgrading to the latest version of the browser usually also brings you sufficiently up to date with signing authority certificates.
For Java's use, you must import the root certificates into all your cacerts files with keytool.
You can always export certificates from one browser and import into another rather that trying to update directly.
With modern JREs, it is most important to get the JREs updated with the recent root certs, then secondarily the browser.
The hassle with using phony certificates is that they must be manually pre-installed on all the client's machines before your signed Applets will be recognised. With real certificates, that step is not necessary. The built-in signing authority root certificate suffices. It is pretty awkward to pre-install certificates for the general public. Phony certificates are more feasible for strictly in-house use.
See signtool or keytool for details of how to create a phony certificate.
To create phony SMIME email authentication certificates in Windows use:
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 JDK 1.5 beta, or any of the browsers. It had to be manually installed, making using the certificate as clumsy as a phony self-signed certificate. Download the root certificate and install it in all the cacerts files on machines that use you application.
Verisign made an minor mistake that is causing severe troubles. They issued several public root jar-signing certificates with the same public key, but different expiry dates. These have been pre-installed in the major browsers.
Unfortunately Netscape is not too bright about how to find the matching root signing authority certificate for a jar. It just takes the first match on public key. This can cause it to pick the wrong root certificate and refuse to accept the jar.
You can encourage it to find the correct one by removing the other Verisign root jar-signing certificates. However, if you do that, it won't be able to verify jars signed by other vendors. I suppose you could remove all but the most recent root Verisign jar-signing certificate and trust all vendors will soon upgrade their certificates. Other solutions: use Thawte certificates which don't have the problem, or wait for Netscape to use improved matching logic.
I am not sure of the precise details and ordering, but roughly it works like this:
For fine-grained privileges (bypassing the RSA ALL/NOTHING default), the end user must include:
However, once the usePolicy is in place, applications may use the javax.security.auth.Subject.doAs(...) or javax.security.auth.Subject.doAsPrivileged(...) methods to request fine-grain privileges. It sounds hideously complicated involving, authenticated Subjects, Principals, AccessControllers, PermissionCollections and Permissions.
Make sure you don't inadvertently give the privilege of rewriting the policy file to a suspect program.
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. (As I discovered with the old Netscape fine grain permissions.) I have little to say about it other that my documentation on how to use keytool. For details see Mitch Gallant's site.
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.g., classes loaded from my local machine can read and write local files, but Applets loaded from the network can't).
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.
In other words that the method's caller, or the caller of that method etc. have permission to do the naughty deed.
You can attach a DomainCombiner to an AccessControlContext that you create (if you have permission to create an AccessControlContext), and then your DomainCombiner gets the opportunity (or responsibility) to touch/modify the set of ProtectionDomains before they are checked for the given permission. JAAS authorization is implemented this way, by attaching a javax.security.auth.SubjectDomainCombiner to the AccessControlContext created in javax.security.auth.Subject.doAs(); this SubjectDomainCombiner uses the JAAS policy object to add the subject's permissions into the permission set of each of the ProtectionDomains on the call stack.
Maybe you didn't really need a signed Applet after all...
KeyStore ks = KeyStore.getInstance ( "PKCS12" ); // for security, KeyStore wants certificate password as char[] char[] password = "Sesame".toCharArray(); ks.load( new FileInputStream( "yourcert.p12" ), password ); Certificate c = ks.getCertificate( "thecert" ); PublicKey p = c.getPublicKey();
To do the equivalent with the .keystore file use .getInstance ( "JKS" ) instead of .getInstance ( "PKCS12" ).
See IBM Redbook Java 2 Network Security for notes on how to create your own certificates (you as issuing authority), for Netscape, IE, and Java 2.
There are some noticeable gaps in Sun's security classes. You can't produce an X.509 certificate for example. The BouncyCastle classes often come to the rescue.
home |
Canadian Mind Products | |||
| mindprod.com IP:[24.87.56.253] | ||||
| Your IP:[80.134.30.163] | ||||
| You are visitor number 36778. | ||||
| Please send errors, omissions and suggestions | ||||
| to improve this page to Roedy Green. | ||||
| You can get a fresh copy of this page from: | or possibly from your local J: drive mirror: | |||
| http://mindprod.com/jgloss/certificate.html | J:\mindprod\jgloss\certificate.html | |||