当前位置: 首页>>代码示例>>Java>>正文


Java TypesWriter.writeMPInt方法代码示例

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


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

示例1: encodeSSHDSAPublicKey

import com.trilead.ssh2.packets.TypesWriter; //导入方法依赖的package包/类
public static byte[] encodeSSHDSAPublicKey(DSAPublicKey pk) throws IOException
{
	TypesWriter tw = new TypesWriter();

	tw.writeString("ssh-dss");

	DSAParams params = pk.getParams();
	tw.writeMPInt(params.getP());
	tw.writeMPInt(params.getQ());
	tw.writeMPInt(params.getG());
	tw.writeMPInt(pk.getY());

	return tw.getBytes();
}
 
开发者ID:dragonlinux,项目名称:connectbot,代码行数:15,代码来源:DSASHA1Verify.java

示例2: encodeSSHRSAPublicKey

import com.trilead.ssh2.packets.TypesWriter; //导入方法依赖的package包/类
public static byte[] encodeSSHRSAPublicKey(RSAPublicKey pk) throws IOException
{
	TypesWriter tw = new TypesWriter();

	tw.writeString("ssh-rsa");
	tw.writeMPInt(pk.getPublicExponent());
	tw.writeMPInt(pk.getModulus());

	return tw.getBytes();
}
 
开发者ID:dragonlinux,项目名称:connectbot,代码行数:11,代码来源:RSASHA1Verify.java

示例3: encodeSSHECDSASignature

import com.trilead.ssh2.packets.TypesWriter; //导入方法依赖的package包/类
public static byte[] encodeSSHECDSASignature(byte[] sig, ECParameterSpec params) throws IOException
{
	TypesWriter tw = new TypesWriter();

	String curveName = getCurveName(params);
	tw.writeString(ECDSA_SHA2_PREFIX + curveName);

	if ((sig[0] != 0x30) || (sig[1] != sig.length - 2) || (sig[2] != 0x02)) {
		throw new IOException("Invalid signature format");
	}

	int rLength = sig[3];
	if ((rLength + 6 > sig.length) || (sig[4 + rLength] != 0x02)) {
		throw new IOException("Invalid signature format");
	}

	int sLength = sig[5 + rLength];
	if (6 + rLength + sLength > sig.length) {
		throw new IOException("Invalid signature format");
	}

	byte[] rArray = new byte[rLength];
	byte[] sArray = new byte[sLength];

	System.arraycopy(sig, 4, rArray, 0, rLength);
	System.arraycopy(sig, 6 + rLength, sArray, 0, sLength);

	BigInteger r = new BigInteger(rArray);
	BigInteger s = new BigInteger(sArray);

	// Write the <r,s> to its own types writer.
	TypesWriter rsWriter = new TypesWriter();
	rsWriter.writeMPInt(r);
	rsWriter.writeMPInt(s);
	byte[] encoded = rsWriter.getBytes();
	tw.writeString(encoded, 0, encoded.length);

	return tw.getBytes();
}
 
开发者ID:dragonlinux,项目名称:connectbot,代码行数:40,代码来源:ECDSASHA2Verify.java

示例4: encodeSSHDSAPublicKey

import com.trilead.ssh2.packets.TypesWriter; //导入方法依赖的package包/类
public static byte[] encodeSSHDSAPublicKey(DSAPublicKey pk) throws IOException
{
	TypesWriter tw = new TypesWriter();

	tw.writeString("ssh-dss");
	tw.writeMPInt(pk.getP());
	tw.writeMPInt(pk.getQ());
	tw.writeMPInt(pk.getG());
	tw.writeMPInt(pk.getY());

	return tw.getBytes();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:DSASHA1Verify.java

示例5: encodeSSHRSAPublicKey

import com.trilead.ssh2.packets.TypesWriter; //导入方法依赖的package包/类
public static byte[] encodeSSHRSAPublicKey(RSAPublicKey pk) throws IOException
{
	TypesWriter tw = new TypesWriter();

	tw.writeString("ssh-rsa");
	tw.writeMPInt(pk.getE());
	tw.writeMPInt(pk.getN());

	return tw.getBytes();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:RSASHA1Verify.java

示例6: encodeSSHDSAPublicKey

import com.trilead.ssh2.packets.TypesWriter; //导入方法依赖的package包/类
public static byte[] encodeSSHDSAPublicKey(DSAPublicKey pk)
		throws IOException {
	TypesWriter tw = new TypesWriter();

	tw.writeString("ssh-dss");
	tw.writeMPInt(pk.getP());
	tw.writeMPInt(pk.getQ());
	tw.writeMPInt(pk.getG());
	tw.writeMPInt(pk.getY());

	return tw.getBytes();
}
 
开发者ID:jianlinwei,项目名称:sshtunnel,代码行数:13,代码来源:DSASHA1Verify.java

示例7: encodeSSHRSAPublicKey

import com.trilead.ssh2.packets.TypesWriter; //导入方法依赖的package包/类
public static byte[] encodeSSHRSAPublicKey(RSAPublicKey pk)
		throws IOException {
	TypesWriter tw = new TypesWriter();

	tw.writeString("ssh-rsa");
	tw.writeMPInt(pk.getE());
	tw.writeMPInt(pk.getN());

	return tw.getBytes();
}
 
开发者ID:jianlinwei,项目名称:sshtunnel,代码行数:11,代码来源:RSASHA1Verify.java


注:本文中的com.trilead.ssh2.packets.TypesWriter.writeMPInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。