本文整理汇总了Java中org.bouncycastle.crypto.params.ECPrivateKeyParameters.getParameters方法的典型用法代码示例。如果您正苦于以下问题:Java ECPrivateKeyParameters.getParameters方法的具体用法?Java ECPrivateKeyParameters.getParameters怎么用?Java ECPrivateKeyParameters.getParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.crypto.params.ECPrivateKeyParameters
的用法示例。
在下文中一共展示了ECPrivateKeyParameters.getParameters方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JCEECPrivateKey
import org.bouncycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
JCEECPrivateKey(
String algorithm,
ECPrivateKeyParameters params,
ECParameterSpec spec)
{
ECDomainParameters dp = params.getParameters();
this.algorithm = algorithm;
this.d = params.getD();
if (spec == null)
{
this.ecSpec = new ECParameterSpec(
dp.getCurve(),
dp.getG(),
dp.getN(),
dp.getH(),
dp.getSeed());
}
else
{
this.ecSpec = spec;
}
}
示例2: JCEECPrivateKey
import org.bouncycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
public JCEECPrivateKey(
String algorithm,
ECPrivateKeyParameters params,
JCEECPublicKey pubKey,
ECParameterSpec spec)
{
ECDomainParameters dp = params.getParameters();
this.algorithm = algorithm;
this.d = params.getD();
if (spec == null)
{
EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
this.ecSpec = new ECParameterSpec(
ellipticCurve,
new ECPoint(
dp.getG().getX().toBigInteger(),
dp.getG().getY().toBigInteger()),
dp.getN(),
dp.getH().intValue());
}
else
{
this.ecSpec = spec;
}
publicKey = getPublicKeyDetails(pubKey);
}
示例3: BCDSTU4145PrivateKey
import org.bouncycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
public BCDSTU4145PrivateKey(
String algorithm,
ECPrivateKeyParameters params,
BCDSTU4145PublicKey pubKey,
ECParameterSpec spec)
{
ECDomainParameters dp = params.getParameters();
this.algorithm = algorithm;
this.d = params.getD();
if (spec == null)
{
EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
this.ecSpec = new ECParameterSpec(
ellipticCurve,
new ECPoint(
dp.getG().getX().toBigInteger(),
dp.getG().getY().toBigInteger()),
dp.getN(),
dp.getH().intValue());
}
else
{
this.ecSpec = spec;
}
publicKey = getPublicKeyDetails(pubKey);
}
示例4: BCECPrivateKey
import org.bouncycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
public BCECPrivateKey(
String algorithm,
ECPrivateKeyParameters params,
BCECPublicKey pubKey,
ECParameterSpec spec,
ProviderConfiguration configuration)
{
ECDomainParameters dp = params.getParameters();
this.algorithm = algorithm;
this.d = params.getD();
this.configuration = configuration;
if (spec == null)
{
EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
this.ecSpec = new ECParameterSpec(
ellipticCurve,
new ECPoint(
dp.getG().getX().toBigInteger(),
dp.getG().getY().toBigInteger()),
dp.getN(),
dp.getH().intValue());
}
else
{
this.ecSpec = spec;
}
publicKey = getPublicKeyDetails(pubKey);
}
示例5: BCECGOST3410PrivateKey
import org.bouncycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
public BCECGOST3410PrivateKey(
String algorithm,
ECPrivateKeyParameters params,
BCECGOST3410PublicKey pubKey,
ECParameterSpec spec)
{
ECDomainParameters dp = params.getParameters();
this.algorithm = algorithm;
this.d = params.getD();
if (spec == null)
{
EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
this.ecSpec = new ECParameterSpec(
ellipticCurve,
new ECPoint(
dp.getG().getX().toBigInteger(),
dp.getG().getY().toBigInteger()),
dp.getN(),
dp.getH().intValue());
}
else
{
this.ecSpec = spec;
}
publicKey = getPublicKeyDetails(pubKey);
}
示例6: JCEECPrivateKey
import org.bouncycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
public JCEECPrivateKey(
String algorithm,
ECPrivateKeyParameters params,
JCEECPublicKey pubKey,
ECParameterSpec spec)
{
ECDomainParameters dp = params.getParameters();
this.algorithm = algorithm;
this.d = params.getD();
if (spec == null)
{
EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
this.ecSpec = new ECParameterSpec(
ellipticCurve,
new ECPoint(
dp.getG().getAffineXCoord().toBigInteger(),
dp.getG().getAffineYCoord().toBigInteger()),
dp.getN(),
dp.getH().intValue());
}
else
{
this.ecSpec = spec;
}
publicKey = getPublicKeyDetails(pubKey);
}
示例7: BCDSTU4145PrivateKey
import org.bouncycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
public BCDSTU4145PrivateKey(
String algorithm,
ECPrivateKeyParameters params,
BCDSTU4145PublicKey pubKey,
ECParameterSpec spec)
{
ECDomainParameters dp = params.getParameters();
this.algorithm = algorithm;
this.d = params.getD();
if (spec == null)
{
EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
this.ecSpec = new ECParameterSpec(
ellipticCurve,
new ECPoint(
dp.getG().getAffineXCoord().toBigInteger(),
dp.getG().getAffineYCoord().toBigInteger()),
dp.getN(),
dp.getH().intValue());
}
else
{
this.ecSpec = spec;
}
publicKey = getPublicKeyDetails(pubKey);
}
示例8: BCECPrivateKey
import org.bouncycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
public BCECPrivateKey(
String algorithm,
ECPrivateKeyParameters params,
BCECPublicKey pubKey,
ECParameterSpec spec,
ProviderConfiguration configuration)
{
ECDomainParameters dp = params.getParameters();
this.algorithm = algorithm;
this.d = params.getD();
this.configuration = configuration;
if (spec == null)
{
EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
this.ecSpec = new ECParameterSpec(
ellipticCurve,
new ECPoint(
dp.getG().getAffineXCoord().toBigInteger(),
dp.getG().getAffineYCoord().toBigInteger()),
dp.getN(),
dp.getH().intValue());
}
else
{
this.ecSpec = spec;
}
publicKey = getPublicKeyDetails(pubKey);
}
示例9: BCECGOST3410PrivateKey
import org.bouncycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
public BCECGOST3410PrivateKey(
String algorithm,
ECPrivateKeyParameters params,
BCECGOST3410PublicKey pubKey,
ECParameterSpec spec)
{
ECDomainParameters dp = params.getParameters();
this.algorithm = algorithm;
this.d = params.getD();
if (spec == null)
{
EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
this.ecSpec = new ECParameterSpec(
ellipticCurve,
new ECPoint(
dp.getG().getAffineXCoord().toBigInteger(),
dp.getG().getAffineYCoord().toBigInteger()),
dp.getN(),
dp.getH().intValue());
}
else
{
this.ecSpec = spec;
}
this.gostParams = pubKey.getGostParams();
publicKey = getPublicKeyDetails(pubKey);
}
示例10: generateThresholdKey
import org.bouncycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
public ECCommittedSecretShareMessage[] generateThresholdKey(String keyID, ECDomainParameters domainParameters, int numberOfPeers, int threshold, ECPoint h)
{
// TODO: should have a source of randomness.
AsymmetricCipherKeyPair keyPair = keyManager.generateKeyPair(keyID, algorithm, numberOfPeers, domainParameters, h);
ECPrivateKeyParameters privKey = (ECPrivateKeyParameters)keyPair.getPrivate();
ECNewDKGSecretSplitter secretSplitter = new ECNewDKGSecretSplitter(numberOfPeers, threshold, h, privKey.getParameters(), new SecureRandom());
ECCommittedSplitSecret splitSecret = secretSplitter.split(privKey.getD());
ECCommittedSecretShare[] shares = splitSecret.getCommittedShares();
ECCommittedSecretShareMessage[] messages = new ECCommittedSecretShareMessage[shares.length];
BigInteger[] aCoefficients = splitSecret.getCoefficients();
ECPoint[] qCommitments = new ECPoint[aCoefficients.length];
for (int i = 0; i != qCommitments.length; i++)
{
qCommitments[i] = privKey.getParameters().getG().multiply(aCoefficients[i]);
}
for (int i = 0; i != shares.length; i++)
{
messages[i] = new ECCommittedSecretShareMessage(i, shares[i].getValue(), shares[i].getWitness(), shares[i].getCommitmentFactors(),
((ECPublicKeyParameters) keyPair.getPublic()).getQ(), qCommitments);
}
return messages;
}
示例11: BCECGOST3410PrivateKey
import org.bouncycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
public BCECGOST3410PrivateKey(
String algorithm,
ECPrivateKeyParameters params,
BCECGOST3410PublicKey pubKey,
ECParameterSpec spec)
{
ECDomainParameters dp = params.getParameters();
this.algorithm = algorithm;
this.d = params.getD();
if (spec == null)
{
EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
this.ecSpec = new ECParameterSpec(
ellipticCurve,
new ECPoint(
dp.getG().getX().toBigInteger(),
dp.getG().getY().toBigInteger()),
dp.getN(),
dp.getH().intValue());
}
else
{
this.ecSpec = spec;
}
this.gostParams = pubKey.getGostParams();
publicKey = getPublicKeyDetails(pubKey);
}
示例12: BCECPrivateKey
import org.bouncycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
public BCECPrivateKey(
String algorithm,
ECPrivateKeyParameters params,
BCECPublicKey pubKey,
ECParameterSpec spec,
ProviderConfiguration configuration)
{
ECDomainParameters dp = params.getParameters();
this.algorithm = algorithm;
this.d = params.getD();
this.configuration = configuration;
if (spec == null)
{
this.ecSpec = new ECParameterSpec(
dp.getCurve(),
dp.getG(),
dp.getN(),
dp.getH(),
dp.getSeed());
}
else
{
this.ecSpec = spec;
}
publicKey = getPublicKeyDetails(pubKey);
}
示例13: BCECGOST3410PrivateKey
import org.bouncycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
public BCECGOST3410PrivateKey(
String algorithm,
ECPrivateKeyParameters params,
BCECGOST3410PublicKey pubKey,
ECParameterSpec spec)
{
ECDomainParameters dp = params.getParameters();
this.algorithm = algorithm;
this.d = params.getD();
if (spec == null)
{
this.ecSpec = new ECParameterSpec(
dp.getCurve(),
dp.getG(),
dp.getN(),
dp.getH(),
dp.getSeed());
}
else
{
this.ecSpec = spec;
}
publicKey = getPublicKeyDetails(pubKey);
}
示例14: decrypt
import org.bouncycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
/**
* Decrypt an encapsulated session key.
*
* @param in the input buffer for the encapsulated key.
* @param inOff the offset for the input buffer.
* @param inLen the length of the encapsulated key.
* @param keyLen the length of the session key.
* @return the session key.
*/
public CipherParameters decrypt(byte[] in, int inOff, int inLen, int keyLen)
throws IllegalArgumentException
{
if (!(key instanceof ECPrivateKeyParameters))
{
throw new IllegalArgumentException("Private key required for encryption");
}
ECPrivateKeyParameters ecPrivKey = (ECPrivateKeyParameters)key;
ECDomainParameters ecParams = ecPrivKey.getParameters();
ECCurve curve = ecParams.getCurve();
BigInteger n = ecParams.getN();
BigInteger h = ecParams.getH();
// Decode the ephemeral public key
byte[] C = new byte[inLen];
System.arraycopy(in, inOff, C, 0, inLen);
// NOTE: Decoded points are already normalized (i.e in affine form)
ECPoint gTilde = curve.decodePoint(C);
// Compute the static-ephemeral key agreement
ECPoint gHat = gTilde;
if ((CofactorMode) || (OldCofactorMode))
{
gHat = gHat.multiply(h);
}
BigInteger xHat = ecPrivKey.getD();
if (CofactorMode)
{
xHat = xHat.multiply(h.modInverse(n)).mod(n);
}
ECPoint hTilde = gHat.multiply(xHat).normalize();
// Encode the shared secret value
byte[] PEH = hTilde.getAffineXCoord().getEncoded();
return deriveKey(keyLen, C, PEH);
}
示例15: decrypt
import org.bouncycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
/**
* Decrypt an encapsulated session key.
*
* @param in the input buffer for the encapsulated key.
* @param inOff the offset for the input buffer.
* @param inLen the length of the encapsulated key.
* @param keyLen the length of the session key.
* @return the session key.
*/
public CipherParameters decrypt(byte[] in, int inOff, int inLen, int keyLen)
throws IllegalArgumentException
{
if (!(key instanceof ECPrivateKeyParameters))
{
throw new IllegalArgumentException("Private key required for encryption");
}
ECPrivateKeyParameters ecPrivKey = (ECPrivateKeyParameters)key;
ECDomainParameters ecParams = ecPrivKey.getParameters();
ECCurve curve = ecParams.getCurve();
BigInteger n = ecParams.getN();
BigInteger h = ecParams.getH();
// Decode the ephemeral public key
byte[] C = new byte[inLen];
System.arraycopy(in, inOff, C, 0, inLen);
// NOTE: Decoded points are already normalized (i.e in affine form)
ECPoint gTilde = curve.decodePoint(C);
// Compute the static-ephemeral key agreement
ECPoint gHat = gTilde;
if ((CofactorMode) || (OldCofactorMode))
{
gHat = gHat.multiply(h);
}
BigInteger xHat = ecPrivKey.getD();
if (CofactorMode)
{
xHat = xHat.multiply(h.modInverse(n)).mod(n);
}
ECPoint hTilde = gHat.multiply(xHat).normalize();
// Encode the shared secret value
byte[] PEH = hTilde.getAffineXCoord().getEncoded();
// Initialise the KDF
byte[] kdfInput;
if (SingleHashMode)
{
kdfInput = new byte[C.length + PEH.length];
System.arraycopy(C, 0, kdfInput, 0, C.length);
System.arraycopy(PEH, 0, kdfInput, C.length, PEH.length);
}
else
{
kdfInput = PEH;
}
kdf.init(new KDFParameters(kdfInput, null));
// Generate the secret key
byte[] K = new byte[keyLen];
kdf.generateBytes(K, 0, K.length);
return new KeyParameter(K);
}