本文整理汇总了Java中com.sun.spot.security.KeyException类的典型用法代码示例。如果您正苦于以下问题:Java KeyException类的具体用法?Java KeyException怎么用?Java KeyException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KeyException类属于com.sun.spot.security包,在下文中一共展示了KeyException类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serializeECPrivateKey
import com.sun.spot.security.KeyException; //导入依赖的package包/类
/** Serializes ECPrivateKey
*/
private static byte[] serializeECPrivateKey(ECPrivateKeyImpl key,
int headerSize) throws KeyException, IOException {
byte[] s = new byte[(key.getSize() + 7) >>> 3];
int sLen = key.getS(s, 0);
if (sLen == 0)
throw new IOException("Serialization of EC Key failed");
/* [curveId][sLength][s] */
/* allocate space for the header, curve id, s length, s */
byte[] rawKey = new byte[headerSize + 1 + 1 + sLen];
int strAddr = headerSize;
rawKey[strAddr] = (byte)key.getCurve();
strAddr ++;
rawKey[strAddr] = (byte)sLen;
strAddr ++;
System.arraycopy(s, 0, rawKey, strAddr, sLen);
return rawKey;
}
示例2: getS
import com.sun.spot.security.KeyException; //导入依赖的package包/类
public int getS(byte[] buffer, int offset) throws KeyException {
if (!initOk) {
throw new KeyException("Key not initialized");
}
ffa.toByteArray(buffer, offset, keyLength, keyData);
return keyLength;
}