org.spongycastle.asn1.ASN1ObjectIdentifier.getEncoded()方法的使用及代码示例

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

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

ASN1ObjectIdentifier.getEncoded介绍

暂无

代码示例

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

public byte[] createKey(ASN1ObjectIdentifier curveOID,  ECPoint s, byte[] recipientFingerPrint)
  throws PGPException
{
  try
  {
    // RFC 6637 - Section 8
    // curve_OID_len = (byte)len(curve_OID);
    // Param = curve_OID_len || curve_OID || public_key_alg_ID || 03
    // || 01 || KDF_hash_ID || KEK_alg_ID for AESKeyWrap || "Anonymous
    // Sender    " || recipient_fingerprint;
    // Z_len = the key size for the KEK_alg_ID used with AESKeyWrap
    // Compute Z = KDF( S, Z_len, Param );
    ByteArrayOutputStream pOut = new ByteArrayOutputStream();
    byte[] encOid = curveOID.getEncoded();
    pOut.write(encOid, 1, encOid.length - 1);
    pOut.write(PublicKeyAlgorithmTags.ECDH);
    pOut.write(0x03);
    pOut.write(0x01);
    pOut.write(digCalc.getAlgorithm());
    pOut.write(keyAlgorithm);
    pOut.write(ANONYMOUS_SENDER);
    pOut.write(recipientFingerPrint);
    return KDF(digCalc, s, getKeyLen(keyAlgorithm), pOut.toByteArray());
  }
  catch (IOException e)
  {
    throw new PGPException("Exception performing KDF: " + e.getMessage(), e);
  }
}

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

public static byte[] createUserKeyingMaterial(PublicKeyPacket pubKeyData, KeyFingerPrintCalculator fingerPrintCalculator)
    throws IOException, PGPException
  {
    ByteArrayOutputStream pOut = new ByteArrayOutputStream();
    ECDHPublicBCPGKey ecKey = (ECDHPublicBCPGKey)pubKeyData.getKey();
    byte[] encOid = ecKey.getCurveOID().getEncoded();

    pOut.write(encOid, 1, encOid.length - 1);
    pOut.write(pubKeyData.getAlgorithm());
    pOut.write(0x03);
    pOut.write(0x01);
    pOut.write(ecKey.getHashAlgorithm());
    pOut.write(ecKey.getSymmetricKeyAlgorithm());
    pOut.write(ANONYMOUS_SENDER);
    pOut.write(fingerPrintCalculator.calculateFingerprint(pubKeyData));

    return pOut.toByteArray();
  }
}

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

void encode(ASN1OutputStream out)
  throws IOException
{
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  if (directReference != null)
  {
    baos.write(directReference.getEncoded(ASN1Encoding.DER));
  }
  if (indirectReference != null)
  {
    baos.write(indirectReference.getEncoded(ASN1Encoding.DER));
  }
  if (dataValueDescriptor != null)
  {
    baos.write(dataValueDescriptor.getEncoded(ASN1Encoding.DER));
  }
  DERTaggedObject obj = new DERTaggedObject(true, encoding, externalContent);
  baos.write(obj.getEncoded(ASN1Encoding.DER));
  out.writeEncoded(BERTags.CONSTRUCTED, BERTags.EXTERNAL, baos.toByteArray());
}

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

void encode(ASN1OutputStream out)
  throws IOException
{
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  if (directReference != null)
  {
    baos.write(directReference.getEncoded(ASN1Encoding.DER));
  }
  if (indirectReference != null)
  {
    baos.write(indirectReference.getEncoded(ASN1Encoding.DER));
  }
  if (dataValueDescriptor != null)
  {
    baos.write(dataValueDescriptor.getEncoded(ASN1Encoding.DER));
  }
  DERTaggedObject obj = new DERTaggedObject(true, encoding, externalContent);
  baos.write(obj.getEncoded(ASN1Encoding.DER));
  out.writeEncoded(BERTags.CONSTRUCTED, BERTags.EXTERNAL, baos.toByteArray());
}

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

public void encode(
  BCPGOutputStream out)
  throws IOException
{
  byte[] oid = this.oid.getEncoded();
  out.write(oid, 1, oid.length - 1);
  MPInteger point = new MPInteger(this.point);
  out.writeObject(point);
}

相关文章