예제 #1
0
  /**
   * @param signerInformation {@code SignerInformation}
   * @return {@code DERTaggedObject} representing the signed attributes
   * @throws DSSException in case of a decoding problem
   */
  public static DERTaggedObject getSignedAttributes(final SignerInformation signerInformation)
      throws DSSException {

    try {
      final byte[] encodedSignedAttributes = signerInformation.getEncodedSignedAttributes();
      if (encodedSignedAttributes == null) {
        return null;
      }
      final ASN1Set asn1Set = DSSASN1Utils.toASN1Primitive(encodedSignedAttributes);
      return new DERTaggedObject(false, 0, asn1Set);
    } catch (IOException e) {
      throw new DSSException(e);
    }
  }
예제 #2
0
  /**
   * This method checks if a given {@code DEROctetString} is null.
   *
   * @param derOctetString
   * @return
   */
  public static boolean isDEROctetStringNull(final DEROctetString derOctetString) {

    final byte[] derOctetStringBytes = derOctetString.getOctets();
    final ASN1Primitive asn1Null = DSSASN1Utils.toASN1Primitive(derOctetStringBytes);
    return DERNull.INSTANCE.equals(asn1Null);
  }