Java Code Examples for com.sun.org.apache.xml.internal.security.c14n.Canonicalizer#ALGO_ID_C14N_OMIT_COMMENTS

The following examples show how to use com.sun.org.apache.xml.internal.security.c14n.Canonicalizer#ALGO_ID_C14N_OMIT_COMMENTS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TruncateHMAC.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static void generate_hmac_sha1_40() throws Exception {
    System.out.println("Generating ");

    Document doc = dbf.newDocumentBuilder().newDocument();
    XMLSignature sig = new XMLSignature
        (doc, null, XMLSignature.ALGO_ID_MAC_HMAC_SHA1, 40,
         Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
    try {
        sig.sign(getSecretKey("secret".getBytes("ASCII")));
        System.out.println("FAILED");
        atLeastOneFailed = true;
    } catch (XMLSignatureException xse) {
        System.out.println(xse.getMessage());
        System.out.println("PASSED");
    }
}
 
Example 2
Source File: TruncateHMAC.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void generate_hmac_sha1_40() throws Exception {
    System.out.println("Generating ");

    Document doc = dbf.newDocumentBuilder().newDocument();
    XMLSignature sig = new XMLSignature
        (doc, null, XMLSignature.ALGO_ID_MAC_HMAC_SHA1, 40,
         Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
    try {
        sig.sign(getSecretKey("secret".getBytes("ASCII")));
        System.out.println("FAILED");
        atLeastOneFailed = true;
    } catch (XMLSignatureException xse) {
        System.out.println(xse.getMessage());
        System.out.println("PASSED");
    }
}
 
Example 3
Source File: TruncateHMAC.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void generate_hmac_sha1_40() throws Exception {
    System.out.println("Generating ");

    Document doc = dbf.newDocumentBuilder().newDocument();
    XMLSignature sig = new XMLSignature
        (doc, null, XMLSignature.ALGO_ID_MAC_HMAC_SHA1, 40,
         Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
    try {
        sig.sign(getSecretKey("secret".getBytes("ASCII")));
        System.out.println("FAILED");
        atLeastOneFailed = true;
    } catch (XMLSignatureException xse) {
        System.out.println(xse.getMessage());
        System.out.println("PASSED");
    }
}
 
Example 4
Source File: TruncateHMAC.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void generate_hmac_sha1_40() throws Exception {
    System.out.println("Generating ");

    Document doc = dbf.newDocumentBuilder().newDocument();
    XMLSignature sig = new XMLSignature
        (doc, null, XMLSignature.ALGO_ID_MAC_HMAC_SHA1, 40,
         Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
    try {
        sig.sign(getSecretKey("secret".getBytes("ASCII")));
        System.out.println("FAILED");
        atLeastOneFailed = true;
    } catch (XMLSignatureException xse) {
        System.out.println(xse.getMessage());
        System.out.println("PASSED");
    }
}
 
Example 5
Source File: TruncateHMAC.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void generate_hmac_sha1_40() throws Exception {
    System.out.println("Generating ");

    Document doc = dbf.newDocumentBuilder().newDocument();
    XMLSignature sig = new XMLSignature
        (doc, null, XMLSignature.ALGO_ID_MAC_HMAC_SHA1, 40,
         Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
    try {
        sig.sign(getSecretKey("secret".getBytes("ASCII")));
        System.out.println("FAILED");
        atLeastOneFailed = true;
    } catch (XMLSignatureException xse) {
        System.out.println(xse.getMessage());
        System.out.println("PASSED");
    }
}
 
Example 6
Source File: TruncateHMAC.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void generate_hmac_sha1_40() throws Exception {
    System.out.println("Generating ");

    Document doc = dbf.newDocumentBuilder().newDocument();
    XMLSignature sig = new XMLSignature
        (doc, null, XMLSignature.ALGO_ID_MAC_HMAC_SHA1, 40,
         Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
    try {
        sig.sign(getSecretKey("secret".getBytes("ASCII")));
        System.out.println("FAILED");
        atLeastOneFailed = true;
    } catch (XMLSignatureException xse) {
        System.out.println(xse.getMessage());
        System.out.println("PASSED");
    }
}
 
Example 7
Source File: Canonicalizer20010315OmitComments.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/** @inheritDoc */
public final String engineGetURI() {
    return Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
}
 
Example 8
Source File: Canonicalizer20010315OmitComments.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/** @inheritDoc */
public final String engineGetURI() {
    return Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
}
 
Example 9
Source File: Canonicalizer20010315OmitComments.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/** @inheritDoc */
public final String engineGetURI() {
    return Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
}
 
Example 10
Source File: Canonicalizer20010315OmitComments.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/** @inheritDoc */
public final String engineGetURI() {
    return Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
}
 
Example 11
Source File: XMLSignature.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Constructor XMLSignature
 *
 * @param doc
 * @param baseURI
 * @param signatureMethodURI the Signature method to be used.
 * @param hmacOutputLength
 * @throws XMLSecurityException
 */
public XMLSignature(Document doc, String baseURI, String signatureMethodURI,
                    int hmacOutputLength) throws XMLSecurityException {
    this(
        doc, baseURI, signatureMethodURI, hmacOutputLength,
        Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS
    );
}
 
Example 12
Source File: XMLSignature.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Constructor XMLSignature
 *
 * @param doc
 * @param baseURI
 * @param signatureMethodURI the Signature method to be used.
 * @param hmacOutputLength
 * @throws XMLSecurityException
 */
public XMLSignature(Document doc, String baseURI, String signatureMethodURI,
                    int hmacOutputLength) throws XMLSecurityException {
    this(
        doc, baseURI, signatureMethodURI, hmacOutputLength,
        Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS
    );
}
 
Example 13
Source File: XMLSignature.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Constructor XMLSignature
 *
 * @param doc
 * @param baseURI
 * @param signatureMethodURI the Signature method to be used.
 * @param hmacOutputLength
 * @throws XMLSecurityException
 */
public XMLSignature(Document doc, String baseURI, String signatureMethodURI,
                    int hmacOutputLength) throws XMLSecurityException {
    this(
        doc, baseURI, signatureMethodURI, hmacOutputLength,
        Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS
    );
}
 
Example 14
Source File: XMLSignature.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Constructor XMLSignature
 *
 * @param doc
 * @param baseURI
 * @param signatureMethodURI the Signature method to be used.
 * @param hmacOutputLength
 * @throws XMLSecurityException
 */
public XMLSignature(Document doc, String baseURI, String signatureMethodURI,
                    int hmacOutputLength) throws XMLSecurityException {
    this(
        doc, baseURI, signatureMethodURI, hmacOutputLength,
        Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS
    );
}
 
Example 15
Source File: SignedInfo.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Overwrites {@link Manifest#addDocument} because it creates another
 * Element.
 *
 * @param doc the {@link Document} in which <code>XMLsignature</code> will
 *    be placed
 * @throws XMLSecurityException
 */
public SignedInfo(Document doc) throws XMLSecurityException {
    this(doc, XMLSignature.ALGO_ID_SIGNATURE_DSA,
         Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
}
 
Example 16
Source File: XMLSignature.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * This creates a new <CODE>ds:Signature</CODE> Element and adds an empty
 * <CODE>ds:SignedInfo</CODE>.
 * The <code>ds:SignedInfo</code> is initialized with the specified Signature
 * algorithm and Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS which is REQUIRED
 * by the spec. This method's main use is for creating a new signature.
 *
 * @param doc Document in which the signature will be appended after creation.
 * @param baseURI URI to be used as context for all relative URIs.
 * @param signatureMethodURI signature algorithm to use.
 * @throws XMLSecurityException
 */
public XMLSignature(Document doc, String baseURI, String signatureMethodURI)
    throws XMLSecurityException {
    this(doc, baseURI, signatureMethodURI, 0, Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
}
 
Example 17
Source File: SignedInfo.java    From jdk8u-dev-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Overwrites {@link Manifest#addDocument} because it creates another
 * Element.
 *
 * @param doc the {@link Document} in which <code>XMLsignature</code> will
 *    be placed
 * @throws XMLSecurityException
 */
public SignedInfo(Document doc) throws XMLSecurityException {
    this(doc, XMLSignature.ALGO_ID_SIGNATURE_DSA,
         Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
}
 
Example 18
Source File: SignedInfo.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Overwrites {@link Manifest#addDocument} because it creates another
 * Element.
 *
 * @param doc the {@link Document} in which <code>XMLsignature</code> will
 *    be placed
 * @throws XMLSecurityException
 */
public SignedInfo(Document doc) throws XMLSecurityException {
    this(doc, XMLSignature.ALGO_ID_SIGNATURE_DSA,
         Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
}
 
Example 19
Source File: XMLSignature.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * This creates a new <CODE>ds:Signature</CODE> Element and adds an empty
 * <CODE>ds:SignedInfo</CODE>.
 * The <code>ds:SignedInfo</code> is initialized with the specified Signature
 * algorithm and Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS which is REQUIRED
 * by the spec. This method's main use is for creating a new signature.
 *
 * @param doc Document in which the signature will be appended after creation.
 * @param baseURI URI to be used as context for all relative URIs.
 * @param signatureMethodURI signature algorithm to use.
 * @throws XMLSecurityException
 */
public XMLSignature(Document doc, String baseURI, String signatureMethodURI)
    throws XMLSecurityException {
    this(doc, baseURI, signatureMethodURI, 0, Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
}
 
Example 20
Source File: SignedInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Overwrites {@link Manifest#addDocument} because it creates another
 * Element.
 *
 * @param doc the {@link Document} in which <code>XMLsignature</code> will
 *    be placed
 * @throws XMLSecurityException
 */
public SignedInfo(Document doc) throws XMLSecurityException {
    this(doc, XMLSignature.ALGO_ID_SIGNATURE_DSA,
         Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
}