本文整理汇总了Java中org.bouncycastle.crypto.params.ECPublicKeyParameters.getParameters方法的典型用法代码示例。如果您正苦于以下问题:Java ECPublicKeyParameters.getParameters方法的具体用法?Java ECPublicKeyParameters.getParameters怎么用?Java ECPublicKeyParameters.getParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.crypto.params.ECPublicKeyParameters
的用法示例。
在下文中一共展示了ECPublicKeyParameters.getParameters方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JCEECPublicKey
import org.bouncycastle.crypto.params.ECPublicKeyParameters; //导入方法依赖的package包/类
public JCEECPublicKey(
String algorithm,
ECPublicKeyParameters params,
ECParameterSpec spec)
{
ECDomainParameters dp = params.getParameters();
this.algorithm = algorithm;
this.q = params.getQ();
if (spec == null)
{
EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
this.ecSpec = createSpec(ellipticCurve, dp);
}
else
{
this.ecSpec = spec;
}
}
示例2: BCDSTU4145PublicKey
import org.bouncycastle.crypto.params.ECPublicKeyParameters; //导入方法依赖的package包/类
public BCDSTU4145PublicKey(
String algorithm,
ECPublicKeyParameters params,
ECParameterSpec spec)
{
ECDomainParameters dp = params.getParameters();
this.algorithm = algorithm;
this.q = params.getQ();
if (spec == null)
{
EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
this.ecSpec = createSpec(ellipticCurve, dp);
}
else
{
this.ecSpec = spec;
}
}
示例3: BCECPublicKey
import org.bouncycastle.crypto.params.ECPublicKeyParameters; //导入方法依赖的package包/类
public BCECPublicKey(
String algorithm,
ECPublicKeyParameters params,
ECParameterSpec spec,
ProviderConfiguration configuration)
{
ECDomainParameters dp = params.getParameters();
this.algorithm = algorithm;
this.q = params.getQ();
if (spec == null)
{
EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
this.ecSpec = createSpec(ellipticCurve, dp);
}
else
{
this.ecSpec = spec;
}
this.configuration = configuration;
}
示例4: BCECGOST3410PublicKey
import org.bouncycastle.crypto.params.ECPublicKeyParameters; //导入方法依赖的package包/类
public BCECGOST3410PublicKey(
String algorithm,
ECPublicKeyParameters params,
ECParameterSpec spec)
{
ECDomainParameters dp = params.getParameters();
this.algorithm = algorithm;
this.q = params.getQ();
if (spec == null)
{
EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
this.ecSpec = createSpec(ellipticCurve, dp);
}
else
{
this.ecSpec = spec;
}
}
示例5: JCEECPublicKey
import org.bouncycastle.crypto.params.ECPublicKeyParameters; //导入方法依赖的package包/类
JCEECPublicKey(
String algorithm,
ECPublicKeyParameters params,
ECParameterSpec spec)
{
ECDomainParameters dp = params.getParameters();
this.algorithm = algorithm;
this.q = params.getQ();
if (spec == null)
{
this.ecSpec = new ECParameterSpec(
dp.getCurve(),
dp.getG(),
dp.getN(),
dp.getH(),
dp.getSeed());
}
else
{
this.ecSpec = spec;
}
}
示例6: calculateAgreement
import org.bouncycastle.crypto.params.ECPublicKeyParameters; //导入方法依赖的package包/类
public BigInteger calculateAgreement(
CipherParameters pubKey)
{
ECPublicKeyParameters pub = (ECPublicKeyParameters)pubKey;
ECDomainParameters params = pub.getParameters();
BigInteger hd = params.getH().multiply(key.getD()).mod(params.getN());
ECPoint P = pub.getQ().multiply(hd).normalize();
if (P.isInfinity())
{
throw new IllegalStateException("Infinity is not a valid agreement value for ECDHC");
}
return P.getAffineXCoord().toBigInteger();
}
示例7: BCECGOST3410PublicKey
import org.bouncycastle.crypto.params.ECPublicKeyParameters; //导入方法依赖的package包/类
public BCECGOST3410PublicKey(
String algorithm,
ECPublicKeyParameters params,
ECParameterSpec spec)
{
ECDomainParameters dp = params.getParameters();
this.algorithm = algorithm;
this.q = params.getQ();
if (spec == null)
{
EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
this.ecSpec = createSpec(ellipticCurve, dp);
}
else
{
this.ecSpec = spec;
}
}
示例8: calculateAgreement
import org.bouncycastle.crypto.params.ECPublicKeyParameters; //导入方法依赖的package包/类
public BigInteger calculateAgreement(
CipherParameters pubKey)
{
ECPublicKeyParameters pub = (ECPublicKeyParameters)pubKey;
ECDomainParameters params = pub.getParameters();
ECPoint P = pub.getQ().multiply(params.getH().multiply(key.getD()));
// if (p.isInfinity()) throw new RuntimeException("Invalid public key");
return P.getX().toBigInteger();
}
示例9: encrypt
import org.bouncycastle.crypto.params.ECPublicKeyParameters; //导入方法依赖的package包/类
/**
* Generate and encapsulate a random session key.
*
* @param out the output buffer for the encapsulated key.
* @param outOff the offset for the output buffer.
* @param keyLen the length of the session key.
* @return the random session key.
*/
public CipherParameters encrypt(byte[] out, int outOff, int keyLen)
throws IllegalArgumentException
{
if (!(key instanceof ECPublicKeyParameters))
{
throw new IllegalArgumentException("Public key required for encryption");
}
ECPublicKeyParameters ecPubKey = (ECPublicKeyParameters)key;
ECDomainParameters ecParams = ecPubKey.getParameters();
ECCurve curve = ecParams.getCurve();
BigInteger n = ecParams.getN();
BigInteger h = ecParams.getH();
// Generate the ephemeral key pair
BigInteger r = BigIntegers.createRandomInRange(ONE, n, rnd);
// Compute the static-ephemeral key agreement
BigInteger rPrime = CofactorMode ? r.multiply(h).mod(n) : r;
ECMultiplier basePointMultiplier = createBasePointMultiplier();
ECPoint[] ghTilde = new ECPoint[]{
basePointMultiplier.multiply(ecParams.getG(), r),
ecPubKey.getQ().multiply(rPrime)
};
// NOTE: More efficient than normalizing each individually
curve.normalizeAll(ghTilde);
ECPoint gTilde = ghTilde[0], hTilde = ghTilde[1];
// Encode the ephemeral public key
byte[] C = gTilde.getEncoded(false);
System.arraycopy(C, 0, out, outOff, C.length);
// Encode the shared secret value
byte[] PEH = hTilde.getAffineXCoord().getEncoded();
return deriveKey(keyLen, C, PEH);
}