gpt4 book ai didi

org.bouncycastle.asn1.x9.X962Parameters类的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 04:57:05 26 4
gpt4 key购买 nike

本文整理了Java中org.bouncycastle.asn1.x9.X962Parameters类的一些代码示例,展示了X962Parameters类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。X962Parameters类的具体详情如下:
包路径:org.bouncycastle.asn1.x9.X962Parameters
类名称:X962Parameters

X962Parameters介绍

[英]The Parameters ASN.1 CHOICE from X9.62.
[中]参数为ASN。1个X9选项。62

代码示例

代码示例来源:origin: redfish64/TinyTravelTracker

public static X962Parameters getInstance(
  Object obj)
{
  if (obj == null || obj instanceof X962Parameters) 
  {
    return (X962Parameters)obj;
  }
  
  if (obj instanceof ASN1Primitive) 
  {
    return new X962Parameters((ASN1Primitive)obj);
  }
  
  throw new IllegalArgumentException("unknown object in getInstance()");
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

@Override
protected void engineInit(byte[] bytes, String format)
  throws IOException
{
  if (isASN1FormatString(format))
  {
    X962Parameters params = X962Parameters.getInstance(bytes);
    ECCurve curve = EC5Util.getCurve(BouncyCastleProvider.CONFIGURATION, params);
    if (params.isNamedCurve())
    {
      ASN1ObjectIdentifier curveId = ASN1ObjectIdentifier.getInstance(params.getParameters());
      curveName = ECNamedCurveTable.getName(curveId);
      if (curveName == null)
      {
        curveName = curveId.getId();
      }
    }
    ecParameterSpec = EC5Util.convertToSpec(params, curve);
  }
  else
  {
    throw new IOException("Unknown encoded parameters format in AlgorithmParameters object: " + format);
  }
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

@Override
protected byte[] engineGetEncoded(String format)
  throws IOException
{
  if (isASN1FormatString(format))
  {
    X962Parameters params;
    if (ecParameterSpec == null)     // implicitly CA
    {
      params = new X962Parameters(DERNull.INSTANCE);
    }
    else if (curveName != null)
    {
      params = new X962Parameters(ECUtil.getNamedCurveOid(curveName));
    }
    else
    {
      org.bouncycastle.jce.spec.ECParameterSpec ecSpec = EC5Util.convertSpec(ecParameterSpec, false);
      X9ECParameters ecP = new X9ECParameters(
        ecSpec.getCurve(),
        ecSpec.getG(),
        ecSpec.getN(),
        ecSpec.getH(),
        ecSpec.getSeed());
      params = new X962Parameters(ecP);
    }
    return params.getEncoded();
  }
  throw new IOException("Unknown parameters format in AlgorithmParameters object: " + format);
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

Set acceptableCurves = configuration.getAcceptableNamedCurves();
if (params.isNamedCurve())
  ASN1ObjectIdentifier oid = ASN1ObjectIdentifier.getInstance(params.getParameters());
else if (params.isImplicitlyCA())
  X9ECParameters ecP = X9ECParameters.getInstance(params.getParameters());

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

X962Parameters params = X962Parameters.getInstance(info.getPrivateKeyAlgorithm().getParameters());
X9ECParameters curveParams;
if (params.isNamedCurve())
  ASN1ObjectIdentifier oid = ASN1ObjectIdentifier.getInstance(params.getParameters());
else if (params.isImplicitlyCA())
params = new X962Parameters(curveParams);

代码示例来源:origin: redfish64/TinyTravelTracker

X962Parameters params = new X962Parameters((ASN1Primitive)algId.getParameters());
if (params.isNamedCurve())
  ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)params.getParameters();
  x9 = X9ECParameters.getInstance(params.getParameters());
  dParams = new ECDomainParameters(
    x9.getCurve(), x9.getG(), x9.getN(), x9.getH(), x9.getSeed());

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

params = new X962Parameters(curveOid);
params = new X962Parameters(DERNull.INSTANCE);
  ecSpec.getCurve().getSeed());
params = new X962Parameters(ecP);
  info = new PrivateKeyInfo(new AlgorithmIdentifier(CryptoProObjectIdentifiers.gostR3410_2001, params.toASN1Primitive()), keyStructure.toASN1Primitive());
  info = new PrivateKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_ecPublicKey, params.toASN1Primitive()), keyStructure.toASN1Primitive());

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public static X962Parameters getInstance(
  ASN1TaggedObject obj,
  boolean          explicit)
{
  return getInstance(obj.getObject()); // must be explicitly tagged
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

X962Parameters params = X962Parameters.getInstance(info.getAlgorithm().getParameters());
X9ECParameters curveParams;
if (params.isNamedCurve())
  ASN1ObjectIdentifier oid = ASN1ObjectIdentifier.getInstance(params.getParameters());
else if (params.isImplicitlyCA())
params = new X962Parameters(curveParams);

代码示例来源:origin: com.hynnet/jradius-extended

X962Parameters      params = new X962Parameters((DERObject)keyInfo.getAlgorithmId().getParameters());
ECDomainParameters  dParams = null;
if (params.isNamedCurve())
  DERObjectIdentifier oid = (DERObjectIdentifier)params.getParameters();
  X9ECParameters      ecP = X962NamedCurves.getByOID(oid);
        (ASN1Sequence)params.getParameters());
  dParams = new ECDomainParameters(
                ecP.getCurve(),

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public static ECDomainParameters getDomainParameters(
  ProviderConfiguration configuration,
  X962Parameters params)
{
  ECDomainParameters domainParameters;
  if (params.isNamedCurve())
  {
    ASN1ObjectIdentifier oid = ASN1ObjectIdentifier.getInstance(params.getParameters());
    X9ECParameters ecP = ECUtil.getNamedCurveByOid(oid);
    if (ecP == null)
    {
      Map extraCurves = configuration.getAdditionalECParameters();
      ecP = (X9ECParameters)extraCurves.get(oid);
    }
    domainParameters = new ECNamedDomainParameters(oid, ecP.getCurve(), ecP.getG(), ecP.getN(), ecP.getH(), ecP.getSeed());
  }
  else if (params.isImplicitlyCA())
  {
    org.bouncycastle.jce.spec.ECParameterSpec iSpec = configuration.getEcImplicitlyCa();
    domainParameters = new ECDomainParameters(iSpec.getCurve(), iSpec.getG(), iSpec.getN(), iSpec.getH(), iSpec.getSeed());
  }
  else
  {
    X9ECParameters ecP = X9ECParameters.getInstance(params.getParameters());
    domainParameters = new ECDomainParameters(ecP.getCurve(), ecP.getG(), ecP.getN(), ecP.getH(), ecP.getSeed());
  }
  return domainParameters;
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

params = new X962Parameters(curveOid);
orderBitLength = ECUtil.getOrderBitLength(BouncyCastleProvider.CONFIGURATION, ecSpec.getOrder(), this.getS());
params = new X962Parameters(DERNull.INSTANCE);
orderBitLength = ECUtil.getOrderBitLength(BouncyCastleProvider.CONFIGURATION, null, this.getS());
  ecSpec.getCurve().getSeed());
params = new X962Parameters(ecP);
orderBitLength = ECUtil.getOrderBitLength(BouncyCastleProvider.CONFIGURATION, ecSpec.getOrder(), this.getS());
  info = new PrivateKeyInfo(new AlgorithmIdentifier(UAObjectIdentifiers.dstu4145be, params.toASN1Primitive()), keyStructure.toASN1Primitive());
  info = new PrivateKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_ecPublicKey, params.toASN1Primitive()), keyStructure.toASN1Primitive());

代码示例来源:origin: redfish64/TinyTravelTracker

public static X962Parameters getInstance(
  ASN1TaggedObject obj,
  boolean          explicit)
{
  return getInstance(obj.getObject()); // must be explicitly tagged
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

AsymmetricKeyParameter getPublicKeyParameters(SubjectPublicKeyInfo keyInfo, Object defaultParams)
  X962Parameters params = X962Parameters.getInstance(keyInfo.getAlgorithm().getParameters());
  ECDomainParameters dParams;
  if (params.isNamedCurve())
    ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)params.getParameters();
      oid, x9.getCurve(), x9.getG(), x9.getN(), x9.getH(), x9.getSeed());
  else if (params.isImplicitlyCA())
    X9ECParameters x9 = X9ECParameters.getInstance(params.getParameters());
    dParams = new ECDomainParameters(
      x9.getCurve(), x9.getG(), x9.getN(), x9.getH(), x9.getSeed());

代码示例来源:origin: net.jradius/jradius-extended

X962Parameters      params = new X962Parameters((DERObject)keyInfo.getAlgorithmId().getParameters());
ECDomainParameters  dParams = null;
if (params.isNamedCurve())
  DERObjectIdentifier oid = (DERObjectIdentifier)params.getParameters();
  X9ECParameters      ecP = X962NamedCurves.getByOID(oid);
        (ASN1Sequence)params.getParameters());
  dParams = new ECDomainParameters(
                ecP.getCurve(),

代码示例来源:origin: coova/jradius

X962Parameters      params = X962Parameters.getInstance(keyInfo.getPrivateKeyAlgorithm().getParameters());
ECDomainParameters  dParams = null;
if (params.isNamedCurve())
  ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier) params.getParameters();
  X9ECParameters      ecP = X962NamedCurves.getByOID(oid);
  X9ECParameters ecP = X9ECParameters.getInstance(params.getParameters());
  dParams = new ECDomainParameters(
                ecP.getCurve(),

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

EllipticCurve ellipticCurve;
if (params.isNamedCurve())
  ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)params.getParameters();
  X9ECParameters ecP = ECUtil.getNamedCurveByOid(oid);
  if (ecP == null)
    ecP.getH());
else if (params.isImplicitlyCA())
  X9ECParameters ecP = X9ECParameters.getInstance(params.getParameters());

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public static X962Parameters getInstance(
  Object obj)
{
  if (obj == null || obj instanceof X962Parameters) 
  {
    return (X962Parameters)obj;
  }
  
  if (obj instanceof ASN1Primitive) 
  {
    return new X962Parameters((ASN1Primitive)obj);
  }
  if (obj instanceof byte[])
  {
    try
    {
      return new X962Parameters(ASN1Primitive.fromByteArray((byte[])obj));
    }
    catch (Exception e)
    {
      throw new IllegalArgumentException("unable to parse encoded data: " + e.getMessage());
    }
  }
  throw new IllegalArgumentException("unknown object in getInstance()");
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

params = new X962Parameters(curveOid);
orderBitLength = ECUtil.getOrderBitLength(BouncyCastleProvider.CONFIGURATION, ecSpec.getOrder(), this.getS());
params = new X962Parameters(DERNull.INSTANCE);
orderBitLength = ECUtil.getOrderBitLength(BouncyCastleProvider.CONFIGURATION, null, this.getS());
  ecSpec.getCurve().getSeed());
params = new X962Parameters(ecP);
orderBitLength = ECUtil.getOrderBitLength(BouncyCastleProvider.CONFIGURATION, ecSpec.getOrder(), this.getS());
info = new PrivateKeyInfo(new AlgorithmIdentifier(identifier, params.toASN1Primitive()), keyStructure.toASN1Primitive());

代码示例来源:origin: org.xipki.tk/security

public static ECPublicKey createECPublicKey(final byte[] encodedAlgorithmIdParameters,
    final byte[] encodedPoint)
    throws InvalidKeySpecException {
  ParamUtil.requireNonNull("encodedAlgorithmIdParameters", encodedAlgorithmIdParameters);
  ParamUtil.requireNonNull("encodedPoint", encodedPoint);
  ASN1Encodable algParams;
  if (encodedAlgorithmIdParameters[0] == 6) {
    algParams = ASN1ObjectIdentifier.getInstance(encodedAlgorithmIdParameters);
  } else {
    algParams = X962Parameters.getInstance(encodedAlgorithmIdParameters);
  }
  AlgorithmIdentifier algId = new AlgorithmIdentifier(
      X9ObjectIdentifiers.id_ecPublicKey, algParams);
  SubjectPublicKeyInfo spki = new SubjectPublicKeyInfo(algId, encodedPoint);
  X509EncodedKeySpec keySpec;
  try {
    keySpec = new X509EncodedKeySpec(spki.getEncoded());
  } catch (IOException ex) {
    throw new InvalidKeySpecException(ex.getMessage(), ex);
  }
  KeyFactory kf;
  try {
    kf = KeyFactory.getInstance("EC", "BC");
  } catch (NoSuchAlgorithmException | NoSuchProviderException ex) {
    throw new InvalidKeySpecException(ex.getMessage(), ex);
  }
  return (ECPublicKey) kf.generatePublic(keySpec);
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com