Apple Security Provider.

Michael Hall mik3hall at gmail.com
Thu May 3 17:59:13 PDT 2012


On May 2, 2012, at 1:47 PM, Sean Mullan wrote:

> Try specifying null for the InputStream parameter. I am not familiar with the OS X implementation, but it sounds like that may have been a bug - according to the KeyStore API, in order to access a KeyStore, you first have to initialize it by calling the load method.

I'd noticed keytool worked ok with it so I wasn't too worried.
But yes, you look to be correct, as to 'load' is needed to init, this works...

import java.security.*;
import java.util.Enumeration;

public class KeyStoreTester {

	public static void main(String[] args) {
		try {
			KeyStore ks = KeyStore.getInstance("KeychainStore","Apple");
			ks.load(null,"ANY".toCharArray());
			System.out.println(ks.getProvider());
			Enumeration<String> e = ks.aliases();
			while (e.hasMoreElements())
				System.out.println(e.nextElement());
		}
		catch (Exception ex) { ex.printStackTrace(); }	
	}
	
}

Apparently the example I copied from was buggy itself or the no init worked at some point.
It's pretty unnecessary as both parameters are really invalid nonsense.
I'd still sort of wonder if you really want to continue calling the Provider Apple as well? But maybe will be addressed a little farther down the road.



More information about the macosx-port-dev mailing list