org.spongycastle.asn1.x509.AlgorithmIdentifier.equals()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(75)

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

AlgorithmIdentifier.equals介绍

暂无

代码示例

代码示例来源:origin: com.madgag.spongycastle/core

/**
 * Return true if the PRF is the default (hmacWithSHA1)
 *
 * @return true if PRF is default, false otherwise.
 */
public boolean isDefaultPrf()
{
  return prf == null || prf.equals(algid_hmacWithSHA1);
}

代码示例来源:origin: com.madgag.spongycastle/prov

/**
 * Return true if this spec is for the default PRF (HmacSHA1), false otherwise.
 *
 * @return true if this spec uses the default PRF, false otherwise.
 */
public boolean isDefaultPrf()
{
  return defaultPRF.equals(prf);
}

代码示例来源:origin: com.madgag.spongycastle/prov

private void writeObject(
    ObjectOutputStream out)
    throws IOException
  {
    out.defaultWriteObject();

    if (!algorithmIdentifier.equals(DEFAULT_ALGORITHM_IDENTIFIER))
    {
      out.writeObject(algorithmIdentifier.getEncoded());
    }
  }
}

代码示例来源:origin: com.madgag.spongycastle/prov

private void doVerify(PublicKey key, Signature sig)
  throws CRLException, NoSuchAlgorithmException,
  InvalidKeyException, SignatureException
{
  if (!c.getSignatureAlgorithm().equals(c.getTBSCertList().getSignature()))
  {
    throw new CRLException("Signature algorithm on CertificateList does not match TBSCertList.");
  }
  sig.initVerify(key);
  sig.update(this.getTBSCertList());
  if (!sig.verify(this.getSignature()))
  {
    throw new SignatureException("CRL does not verify with supplied public key.");
  }
}

代码示例来源:origin: com.madgag.spongycastle/prov

private void doVerify(PublicKey key, Signature sig)
  throws CRLException, NoSuchAlgorithmException,
  InvalidKeyException, SignatureException
{
  if (!c.getSignatureAlgorithm().equals(c.getTBSCertList().getSignature()))
  {
    throw new CRLException("Signature algorithm on CertificateList does not match TBSCertList.");
  }
  sig.initVerify(key);
  sig.update(this.getTBSCertList());
  if (!sig.verify(this.getSignature()))
  {
    throw new SignatureException("CRL does not verify with supplied public key.");
  }
}

代码示例来源:origin: com.madgag.spongycastle/core

if (!hashAlgorithm.equals(DEFAULT_HASH_ALGORITHM))
if (!maskGenAlgorithm.equals(DEFAULT_MASK_GEN_FUNCTION))
if (!pSourceAlgorithm.equals(DEFAULT_P_SOURCE_ALGORITHM))

代码示例来源:origin: com.madgag/sc-light-jdk15on

if (!hashAlgorithm.equals(DEFAULT_HASH_ALGORITHM))
if (!maskGenAlgorithm.equals(DEFAULT_MASK_GEN_FUNCTION))
if (!pSourceAlgorithm.equals(DEFAULT_P_SOURCE_ALGORITHM))

代码示例来源:origin: com.madgag/scprov-jdk15on

public void verify(PublicKey key, String sigProvider)
  throws CRLException, NoSuchAlgorithmException,
    InvalidKeyException, NoSuchProviderException, SignatureException
{
  if (!c.getSignatureAlgorithm().equals(c.getTBSCertList().getSignature()))
  {
    throw new CRLException("Signature algorithm on CertificateList does not match TBSCertList.");
  }
  Signature sig;
  if (sigProvider != null)
  {
    sig = Signature.getInstance(getSigAlgName(), sigProvider);
  }
  else
  {
    sig = Signature.getInstance(getSigAlgName());
  }
  sig.initVerify(key);
  sig.update(this.getTBSCertList());
  if (!sig.verify(this.getSignature()))
  {
    throw new SignatureException("CRL does not verify with supplied public key.");
  }
}

代码示例来源:origin: com.madgag.spongycastle/prov

public final void verify(
    PublicKey   key,
    String      provider)
    throws CertificateException, NoSuchAlgorithmException,
    InvalidKeyException, NoSuchProviderException, SignatureException
{
  Signature   signature = null;
  if (!cert.getSignatureAlgorithm().equals(cert.getAcinfo().getSignature()))
  {
    throw new CertificateException("Signature algorithm in certificate info not same as outer certificate");
  }
  signature = Signature.getInstance(cert.getSignatureAlgorithm().getAlgorithm().getId(), provider);
  signature.initVerify(key);
  try
  {
    signature.update(cert.getAcinfo().getEncoded());
  }
  catch (IOException e)
  {
    throw new SignatureException("Exception encoding certificate info object");
  }
  if (!signature.verify(this.getSignature()))
  {
    throw new InvalidKeyException("Public key presented not for certificate signature");
  }
}

代码示例来源:origin: com.madgag/scprov-jdk15on

public final void verify(
    PublicKey   key,
    String      provider)
    throws CertificateException, NoSuchAlgorithmException,
    InvalidKeyException, NoSuchProviderException, SignatureException
{
  Signature   signature = null;
  if (!cert.getSignatureAlgorithm().equals(cert.getAcinfo().getSignature()))
  {
    throw new CertificateException("Signature algorithm in certificate info not same as outer certificate");
  }
  signature = Signature.getInstance(cert.getSignatureAlgorithm().getObjectId().getId(), provider);
  signature.initVerify(key);
  try
  {
    signature.update(cert.getAcinfo().getEncoded());
  }
  catch (IOException e)
  {
    throw new SignatureException("Exception encoding certificate info object");
  }
  if (!signature.verify(this.getSignature()))
  {
    throw new InvalidKeyException("Public key presented not for certificate signature");
  }
}

代码示例来源:origin: com.madgag.spongycastle/pkix

/**
 * Calculate a RespID based on the public key of the responder.
 *
 * @param subjectPublicKeyInfo the info structure for the responder public key.
 * @param digCalc a SHA-1 digest calculator.
 * @throws OCSPException on exception creating ID.
 */
public RespID(
  SubjectPublicKeyInfo     subjectPublicKeyInfo,
  DigestCalculator         digCalc)
  throws OCSPException
{
  try
  {
    if (!digCalc.getAlgorithmIdentifier().equals(HASH_SHA1))
    {
      throw new IllegalArgumentException("only SHA-1 can be used with RespID");
    }
    OutputStream     digOut = digCalc.getOutputStream();
    digOut.write(subjectPublicKeyInfo.getPublicKeyData().getBytes());
    digOut.close();
    this.id = new ResponderID(new DEROctetString(digCalc.getDigest()));
  }
  catch (Exception e)
  {
    throw new OCSPException("problem creating ID: " + e, e);
  }
}

代码示例来源:origin: com.madgag.spongycastle/bcpkix-jdk15on

/**
 * Calculate a RespID based on the public key of the responder.
 *
 * @param subjectPublicKeyInfo the info structure for the responder public key.
 * @param digCalc a SHA-1 digest calculator.
 * @throws OCSPException on exception creating ID.
 */
public RespID(
  SubjectPublicKeyInfo     subjectPublicKeyInfo,
  DigestCalculator         digCalc)
  throws OCSPException
{
  try
  {
    if (!digCalc.getAlgorithmIdentifier().equals(HASH_SHA1))
    {
      throw new IllegalArgumentException("only SHA-1 can be used with RespID - found: " + digCalc.getAlgorithmIdentifier().getAlgorithm());
    }
    OutputStream     digOut = digCalc.getOutputStream();
    digOut.write(subjectPublicKeyInfo.getPublicKeyData().getBytes());
    digOut.close();
    this.id = new ResponderID(new DEROctetString(digCalc.getDigest()));
  }
  catch (Exception e)
  {
    throw new OCSPException("problem creating ID: " + e, e);
  }
}

代码示例来源:origin: com.madgag.spongycastle/core

/**
   * Return an ASN.1 structure suitable for encoding.
   *
   * @return the object as an ASN.1 encodable structure.
   */
  public ASN1Primitive toASN1Primitive()
  {
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(octStr);
    v.add(iterationCount);

    if (keyLength != null)
    {
      v.add(keyLength);
    }

    if (prf != null && !prf.equals(algid_hmacWithSHA1))
    {
      v.add(prf);
    }

    return new DERSequence(v);
  }
}

代码示例来源:origin: com.madgag.spongycastle/core

if (!hashAlgorithm.equals(DEFAULT_ALG_ID))

代码示例来源:origin: com.madgag.spongycastle/core

if (!hashAlgorithm.equals(DEFAULT_HASH_ALGORITHM))
if (!maskGenAlgorithm.equals(DEFAULT_MASK_GEN_FUNCTION))

代码示例来源:origin: com.madgag/sc-light-jdk15on

if (!hashAlgorithm.equals(DEFAULT_HASH_ALGORITHM))
if (!maskGenAlgorithm.equals(DEFAULT_MASK_GEN_FUNCTION))

代码示例来源:origin: com.madgag/sc-light-jdk15on

if (!hashAlgorithm.equals(DEFAULT_ALG_ID))

代码示例来源:origin: com.madgag.spongycastle/prov

if (!storeData.getIntegrityAlgorithm().equals(hmacAlgorithm))

代码示例来源:origin: com.madgag.spongycastle/bcpkix-jdk15on

private boolean notDefaultPSSParams(ASN1Sequence seq)
    throws GeneralSecurityException
  {
    if (seq == null || seq.size() == 0)
    {
      return false;
    }

    RSASSAPSSparams pssParams = RSASSAPSSparams.getInstance(seq);

    if (!pssParams.getMaskGenAlgorithm().getAlgorithm().equals(PKCSObjectIdentifiers.id_mgf1))
    {
      return true;
    }

    // same digest for sig and MGF1
    if (!pssParams.getHashAlgorithm().equals(AlgorithmIdentifier.getInstance(pssParams.getMaskGenAlgorithm().getParameters())))
    {
      return true;
    }

    MessageDigest digest = createDigest(pssParams.getHashAlgorithm());

    return pssParams.getSaltLength().intValue() != digest.getDigestLength();
  }
}

代码示例来源:origin: com.madgag.spongycastle/pkix

if (workingPublicKey.getAlgorithm().equals(workingAlgId))

相关文章