本文整理汇总了Java中org.bouncycastle.crypto.params.ECDomainParameters类的典型用法代码示例。如果您正苦于以下问题:Java ECDomainParameters类的具体用法?Java ECDomainParameters怎么用?Java ECDomainParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ECDomainParameters类属于org.bouncycastle.crypto.params包,在下文中一共展示了ECDomainParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JCEECPublicKey
import org.bouncycastle.crypto.params.ECDomainParameters; //导入依赖的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: processServerKeyExchange
import org.bouncycastle.crypto.params.ECDomainParameters; //导入依赖的package包/类
public void processServerKeyExchange(InputStream input)
throws IOException
{
SecurityParameters securityParameters = context.getSecurityParameters();
Signer signer = initVerifyer(tlsSigner, securityParameters);
InputStream sigIn = new SignerInputStream(input, signer);
ECDomainParameters curve_params = TlsECCUtils.readECParameters(namedCurves, clientECPointFormats, sigIn);
byte[] point = TlsUtils.readOpaque8(sigIn);
byte[] sigByte = TlsUtils.readOpaque16(input);
if (!signer.verifySignature(sigByte))
{
throw new TlsFatalAlert(AlertDescription.decrypt_error);
}
this.ecAgreeServerPublicKey = TlsECCUtils.validateECPublicKey(TlsECCUtils.deserializeECPublicKey(
clientECPointFormats, curve_params, point));
}
示例3: getParametersForNamedCurve
import org.bouncycastle.crypto.params.ECDomainParameters; //导入依赖的package包/类
public static ECDomainParameters getParametersForNamedCurve(int namedCurve)
{
String curveName = getNameOfNamedCurve(namedCurve);
if (curveName == null)
{
return null;
}
// Lazily created the first time a particular curve is accessed
X9ECParameters ecP = SECNamedCurves.getByName(curveName);
if (ecP == null)
{
return null;
}
// It's a bit inefficient to do this conversion every time
return new ECDomainParameters(ecP.getCurve(), ecP.getG(), ecP.getN(), ecP.getH(), ecP.getSeed());
}
示例4: processClientKeyExchange
import org.bouncycastle.crypto.params.ECDomainParameters; //导入依赖的package包/类
public void processClientKeyExchange(InputStream input)
throws IOException
{
if (ecAgreeClientPublicKey != null)
{
// For ecdsa_fixed_ecdh and rsa_fixed_ecdh, the key arrived in the client certificate
return;
}
byte[] point = TlsUtils.readOpaque8(input);
ECDomainParameters curve_params = this.ecAgreeServerPrivateKey.getParameters();
this.ecAgreeClientPublicKey = TlsECCUtils.validateECPublicKey(TlsECCUtils.deserializeECPublicKey(
serverECPointFormats, curve_params, point));
}
示例5: DSTU4145ECBinary
import org.bouncycastle.crypto.params.ECDomainParameters; //导入依赖的package包/类
public DSTU4145ECBinary(ECDomainParameters params)
{
if (!(params.getCurve() instanceof ECCurve.F2m))
{
throw new IllegalArgumentException("only binary domain is possible");
}
// We always use big-endian in parameter encoding
ECCurve.F2m curve = (ECCurve.F2m)params.getCurve();
f = new DSTU4145BinaryField(curve.getM(), curve.getK1(), curve.getK2(), curve.getK3());
a = new ASN1Integer(curve.getA().toBigInteger());
X9IntegerConverter converter = new X9IntegerConverter();
b = new DEROctetString(converter.integerToBytes(curve.getB().toBigInteger(), converter.getByteLength(curve)));
n = new ASN1Integer(params.getN());
bp = new DEROctetString(DSTU4145PointEncoder.encodePoint(params.getG()));
}
示例6: BCDSTU4145PublicKey
import org.bouncycastle.crypto.params.ECDomainParameters; //导入依赖的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;
}
}
示例7: BCECPublicKey
import org.bouncycastle.crypto.params.ECDomainParameters; //导入依赖的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;
}
示例8: BCECGOST3410PublicKey
import org.bouncycastle.crypto.params.ECDomainParameters; //导入依赖的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;
}
}
示例9: JCEECPrivateKey
import org.bouncycastle.crypto.params.ECDomainParameters; //导入依赖的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;
}
}
示例10: generatePublicKeyParameter
import org.bouncycastle.crypto.params.ECDomainParameters; //导入依赖的package包/类
static public AsymmetricKeyParameter generatePublicKeyParameter(
PublicKey key)
throws InvalidKeyException
{
if (key instanceof ECPublicKey)
{
ECPublicKey k = (ECPublicKey)key;
ECParameterSpec s = k.getParams();
return new ECPublicKeyParameters(
k.getQ(),
new ECDomainParameters(s.getCurve(), s.getG(), s.getN()));
}
throw new InvalidKeyException("can't identify EC public key.");
}
示例11: generatePrivateKeyParameter
import org.bouncycastle.crypto.params.ECDomainParameters; //导入依赖的package包/类
static public AsymmetricKeyParameter generatePrivateKeyParameter(
PrivateKey key)
throws InvalidKeyException
{
if (key instanceof ECPrivateKey)
{
ECPrivateKey k = (ECPrivateKey)key;
ECParameterSpec s = k.getParams();
return new ECPrivateKeyParameters(
k.getD(),
new ECDomainParameters(s.getCurve(), s.getG(), s.getN()));
}
throw new InvalidKeyException("can't identify EC private key.");
}
示例12: initialize
import org.bouncycastle.crypto.params.ECDomainParameters; //导入依赖的package包/类
public void initialize(
int strength,
SecureRandom random)
{
this.strength = strength;
this.random = random;
this.ecParams = (ECParameterSpec)ecParameters.get(new Integer(strength));
if (ecParams != null)
{
param = new ECKeyGenerationParameters(new ECDomainParameters(ecParams.getCurve(), ecParams.getG(), ecParams.getN()), random);
engine.init(param);
initialised = true;
}
}
示例13: JCEECPublicKey
import org.bouncycastle.crypto.params.ECDomainParameters; //导入依赖的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;
}
}
示例14: BCECGOST3410PublicKey
import org.bouncycastle.crypto.params.ECDomainParameters; //导入依赖的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;
}
}
示例15: processServerKeyExchange
import org.bouncycastle.crypto.params.ECDomainParameters; //导入依赖的package包/类
public void processServerKeyExchange(InputStream input)
throws IOException
{
SecurityParameters securityParameters = context.getSecurityParameters();
SignerInputBuffer buf = new SignerInputBuffer();
InputStream teeIn = new TeeInputStream(input, buf);
ECDomainParameters curve_params = TlsECCUtils.readECParameters(namedCurves, clientECPointFormats, teeIn);
byte[] point = TlsUtils.readOpaque8(teeIn);
DigitallySigned signed_params = parseSignature(input);
Signer signer = initVerifyer(tlsSigner, signed_params.getAlgorithm(), securityParameters);
buf.updateSigner(signer);
if (!signer.verifySignature(signed_params.getSignature()))
{
throw new TlsFatalAlert(AlertDescription.decrypt_error);
}
this.ecAgreePublicKey = TlsECCUtils.validateECPublicKey(TlsECCUtils.deserializeECPublicKey(
clientECPointFormats, curve_params, point));
}