本文整理汇总了Java中org.bouncycastle.bcpg.BCPGKey类的典型用法代码示例。如果您正苦于以下问题:Java BCPGKey类的具体用法?Java BCPGKey怎么用?Java BCPGKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BCPGKey类属于org.bouncycastle.bcpg包,在下文中一共展示了BCPGKey类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: mockPrivateKey
import org.bouncycastle.bcpg.BCPGKey; //导入依赖的package包/类
private static PGPPrivateKey mockPrivateKey(
boolean altId,
boolean altBcpgKeyFormat,
boolean altBcpgKeyEncoded,
boolean altPublicKeyPacketEncoded)
throws IOException {
String bcpgKeyFormat = altBcpgKeyFormat ? "alternate" : "bcpgFormat";
String bcpgKeyEncoded = altBcpgKeyEncoded ? "alternate" : "bcpgEncoded";
String publicKeyPacketEncoded = altPublicKeyPacketEncoded ? "alternate" : "packetEncoded";
BCPGKey bcpgKey = mock(BCPGKey.class);
PublicKeyPacket publicKeyPacket = mock(PublicKeyPacket.class);
when(bcpgKey.getFormat()).thenReturn(bcpgKeyFormat);
when(bcpgKey.getEncoded()).thenReturn(bcpgKeyEncoded.getBytes(UTF_8));
when(publicKeyPacket.getEncoded()).thenReturn(publicKeyPacketEncoded.getBytes(UTF_8));
return new PGPPrivateKey(altId ? 2 : 1, publicKeyPacket, bcpgKey);
}
开发者ID:google,项目名称:nomulus,代码行数:18,代码来源:ComparatorKeyringTest.java
示例2: PGPPrivateKey
import org.bouncycastle.bcpg.BCPGKey; //导入依赖的package包/类
public PGPPrivateKey(
long keyID,
PublicKeyPacket publicKeyPacket,
BCPGKey privateKeyDataPacket)
{
this.keyID = keyID;
this.publicKeyPacket = publicKeyPacket;
this.privateKeyDataPacket = privateKeyDataPacket;
}
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:10,代码来源:PGPPrivateKey.java
示例3: init
import org.bouncycastle.bcpg.BCPGKey; //导入依赖的package包/类
private void init(KeyFingerPrintCalculator fingerPrintCalculator)
throws PGPException
{
BCPGKey key = publicPk.getKey();
this.fingerprint = fingerPrintCalculator.calculateFingerprint(publicPk);
if (publicPk.getVersion() <= 3)
{
RSAPublicBCPGKey rK = (RSAPublicBCPGKey)key;
this.keyID = rK.getModulus().longValue();
this.keyStrength = rK.getModulus().bitLength();
}
else
{
this.keyID = ((long)(fingerprint[fingerprint.length - 8] & 0xff) << 56)
| ((long)(fingerprint[fingerprint.length - 7] & 0xff) << 48)
| ((long)(fingerprint[fingerprint.length - 6] & 0xff) << 40)
| ((long)(fingerprint[fingerprint.length - 5] & 0xff) << 32)
| ((long)(fingerprint[fingerprint.length - 4] & 0xff) << 24)
| ((long)(fingerprint[fingerprint.length - 3] & 0xff) << 16)
| ((long)(fingerprint[fingerprint.length - 2] & 0xff) << 8)
| ((fingerprint[fingerprint.length - 1] & 0xff));
if (key instanceof RSAPublicBCPGKey)
{
this.keyStrength = ((RSAPublicBCPGKey)key).getModulus().bitLength();
}
else if (key instanceof DSAPublicBCPGKey)
{
this.keyStrength = ((DSAPublicBCPGKey)key).getP().bitLength();
}
else if (key instanceof ElGamalPublicBCPGKey)
{
this.keyStrength = ((ElGamalPublicBCPGKey)key).getP().bitLength();
}
}
}
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:40,代码来源:PGPPublicKey.java
示例4: compare
import org.bouncycastle.bcpg.BCPGKey; //导入依赖的package包/类
@VisibleForTesting
static boolean compare(BCPGKey a, BCPGKey b) {
if (a == null || b == null) {
return a == null && b == null;
}
return Objects.equals(a.getFormat(), b.getFormat())
&& Arrays.equals(a.getEncoded(), b.getEncoded());
}
开发者ID:google,项目名称:nomulus,代码行数:9,代码来源:ComparatorKeyring.java
示例5: checkWeakKey
import org.bouncycastle.bcpg.BCPGKey; //导入依赖的package包/类
private final static void checkWeakKey(PGPPublicKey pk)
throws PGPException
{
BCPGKey k = pk.getPublicKeyPacket().getKey();
if (k instanceof RSAPublicBCPGKey) {
checkWeakRSA((RSAPublicBCPGKey) k);
}
else if (k instanceof DSAPublicBCPGKey) {
checkDSA((DSAPublicBCPGKey) k);
}
// tbd
}
开发者ID:kbsriram,项目名称:keypan,代码行数:13,代码来源:CPGPUtils.java
示例6: getPrivateKeyDataPacket
import org.bouncycastle.bcpg.BCPGKey; //导入依赖的package包/类
public BCPGKey getPrivateKeyDataPacket()
{
return privateKeyDataPacket;
}
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:5,代码来源:PGPPrivateKey.java
示例7: PGPPrivateKey
import org.bouncycastle.bcpg.BCPGKey; //导入依赖的package包/类
/**
* Base constructor.
*
* Create a PGPPrivateKey from a keyID and the associated public/private data packets needed
* to fully describe it.
*
* @param keyID keyID associated with the public key.
* @param publicKeyPacket the public key data packet to be associated with this private key.
* @param privateKeyDataPacket the private key data packet to be associate with this private key.
*/
public PGPPrivateKey(
long keyID,
PublicKeyPacket publicKeyPacket,
BCPGKey privateKeyDataPacket)
{
this.keyID = keyID;
this.publicKeyPacket = publicKeyPacket;
this.privateKeyDataPacket = privateKeyDataPacket;
}
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:20,代码来源:PGPPrivateKey.java
示例8: getPrivateKeyDataPacket
import org.bouncycastle.bcpg.BCPGKey; //导入依赖的package包/类
/**
* Return the private key packet associated with this private key, if available.
*
* @return associated private key packet, null otherwise.
*/
public BCPGKey getPrivateKeyDataPacket()
{
return privateKeyDataPacket;
}
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:10,代码来源:PGPPrivateKey.java
注:本文中的org.bouncycastle.bcpg.BCPGKey类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论