Java HomekitServer.generateKey方法代码示例(javahomekitserver.generatekey方法代码示例)

本文整理汇总了Java中com.beowulfe.hap.HomekitServer.generateKey方法的典型用法代码示例。如果您正苦于以下问题:Java HomekitServer.generateKey方法的具体用法?Java HomekitServer.generateKey怎么用?Java HomekitServer.generateKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.beowulfe.hap.HomekitServer的用法示例。


Java HomekitServer.generateKey方法代码示例(javahomekitserver.generatekey方法代码示例)

在下文中一共展示了HomekitServer.generateKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: MockAuthInfoService

import com.beowulfe.hap.HomekitServer; //导入方法依赖的package包/类
public MockAuthInfoService() throws InvalidAlgorithmParameterException {

		Properties props = new Properties();
		try {
			InputStream resourceAsStream = new FileInputStream(new File(HOME_HAP+"server.properties"));

			if (resourceAsStream != null) {
				props.load(resourceAsStream);
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		if (props.getProperty("mac") != null) {
			System.out.println("using existing config");
			mac = props.getProperty("mac");
			salt = new BigInteger(Base64.decodeBase64((String) props.get("salt")));

			privateKey = readKey("privateKey");

			System.out.println(new String(privateKey));
			System.out.println(mac);
			System.out.println(salt);

		} else {
			System.out.println("generating new config");
			mac = HomekitServer.generateMac();
			salt = HomekitServer.generateSalt();
			privateKey = HomekitServer.generateKey();
			System.out.println("SALT: " + salt);
			System.out.println("KEY: " + new String(privateKey));
			saveParamChanges(mac, salt, privateKey);

			saveKey("privateKey", privateKey);
		}

		System.out.println(
				"Auth info is generated each time the sample application is started. Pairings are not persisted.");
		System.out.println("The PIN for pairing is " + PIN);
	} 
开发者ID:comdata,项目名称:HomeAutomation,代码行数:42,代码来源:MockAuthInfoService.java

示例2: AuthInfoService

import com.beowulfe.hap.HomekitServer; //导入方法依赖的package包/类
public AuthInfoService() throws InvalidAlgorithmParameterException {

		Properties props = new Properties();
		try {
			InputStream resourceAsStream = new FileInputStream(new File("/home/hap/" + "server.properties"));

			if (resourceAsStream != null) {
				props.load(resourceAsStream);
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		if (props.getProperty("mac") != null) {
			System.out.println("using existing config");
			mac = props.getProperty("mac");
			salt = new BigInteger(Base64.decodeBase64((String) props.get("salt")));

			privateKey = readKey("privateKey");

			System.out.println(new String(privateKey));
			System.out.println(mac);
			System.out.println(salt);

			loadUsers();

		} else {
			System.out.println("generating new config");
			mac = "04:a1:51:69:94:55";// HomekitServer.generateMac();
			salt = HomekitServer.generateSalt();
			privateKey = HomekitServer.generateKey();
			System.out.println("SALT: " + salt);
			System.out.println("KEY: " + new String(privateKey));
			saveParamChanges(mac, salt, privateKey);

			saveKey("privateKey", privateKey);
		}

		System.out.println(
				"Auth info is generated each time the sample application is started. Pairings are not persisted.");
		System.out.println("The PIN for pairing is " + PIN);
	} 
开发者ID:comdata,项目名称:HomeAutomation,代码行数:44,代码来源:AuthInfoService.java

本文标签属性:

示例:示例志愿表

代码:代码编程

java:java自行车

HomekitServer:HomekitServer

generateKey:generateKey

上一篇:C# Icon.MakeTransparent方法代码示例(c#icon.maketransparent方法的5个代码示例)
下一篇:国内油价将于8月23日24时起调整 加满一箱油多花2元左右(买5千克苹果比4千克香蕉多花2元,每千克香蕉3.5元,每千克苹果多少...)(8月23日24时调价窗口将于2023年8月23日24时开启)

为您推荐