Examples of sign()


Examples of org.apache.hadoop.security.authentication.util.Signer.sign()

    AuthenticationToken token =
      new AuthenticationToken("u", "p",
        HttpFSKerberosAuthenticationHandlerForTesting.TYPE);
    token.setExpires(System.currentTimeMillis() + 100000000);
    Signer signer = new Signer("secret".getBytes());
    String tokenSigned = signer.sign(token.toString());

    url = new URL(TestJettyHelper.getJettyURL(),
                  "/webhdfs/v1/?op=GETHOMEDIRECTORY");
    conn = (HttpURLConnection) url.openConnection();
    conn.setRequestProperty("Cookie",
View Full Code Here

Examples of org.apache.harmony.security.tests.support.MySignature1.sign()

   * Class under test for byte[] sign()
   */
  public void testSign() throws Exception {
    MySignature1 s = new MySignature1("ABC");
    try {
      s.sign();
      fail("No expected SignatureException");
    } catch (SignatureException e) {   
    }

    s.initVerify(new MyPublicKey());
View Full Code Here

Examples of org.apache.harmony.xnet.provider.jsse.DigitalSignature.sign()

                0x11, 0x12, 0x13 };

        dsig.setMD5(md5);
        dsig.setSHA(sha1);

        byte[] enc = dsig.sign();

        // Now let's verify
        dsig.init(cert);
        assertTrue(dsig.verifySignature(enc));
    }
View Full Code Here

Examples of org.apache.ivy.plugins.signer.SignatureGenerator.sign()

        }

        File tempFile = File.createTempFile("ivytemp", gen.getExtension());

        try {
            gen.sign(src, tempFile);
            repository.put(
                DefaultArtifact.cloneWithAnotherTypeAndExt(artifact, gen.getExtension(),
                    artifact.getExt() + "." + gen.getExtension()), tempFile,
                dest + "." + gen.getExtension(), overwrite);
        } finally {
View Full Code Here

Examples of org.apache.james.jdkim.DKIMSigner.sign()

                bhj.getOutputStream().close();
            } catch (IOException e) {
                throw new MessagingException("Exception calculating bodyhash: "
                        + e.getMessage(), e);
            }
            String signatureHeader = signer.sign(headers, bhj);
            // Unfortunately JavaMail does not give us a method to add headers
            // on top.
            // message.addHeaderLine(signatureHeader);
            prependHeader(message, signatureHeader);
        } catch (PermFailException e) {
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureInterface.sign()

        SequenceInputStream signStream = new SequenceInputStream(new ByteArrayInputStream(inputBytes),
                new ByteArrayInputStream(signBuffer));

        // sign the bytes
        SignatureInterface signatureInterface = doc.getSignatureInterface();
        byte[] sign = signatureInterface.sign(signStream);
        String signature = new COSString(sign).getHexString();
        // substract 2 bytes because of the enclosing "<>"
        if (signature.length() > signatureLength - 2)
        {
            throw new IOException("Can't write signature, not enough space");
View Full Code Here

Examples of org.apache.sshd.common.Signature.sign()

                bs.putPublicKey(key.getPublic());
                verif.update(bs.array(), bs.rpos(), bs.available());

                bs = new Buffer();
                bs.putString((key.getPublic() instanceof RSAPublicKey) ? KeyPairProvider.SSH_RSA : KeyPairProvider.SSH_DSS);
                bs.putBytes(verif.sign());
                buffer.putBytes(bs.array(), bs.rpos(), bs.available());

                session.writePacket(buffer);
                return Result.Continued;
            } catch (IOException e) {
View Full Code Here

Examples of org.apache.xml.security.algorithms.SignatureAlgorithm.sign()

                    }
                }
            }

            // set them on the SignatureValue element
            this.setSignatureValueElement(sa.sign());
        } catch (XMLSignatureException ex) {
            throw ex;
        } catch (CanonicalizationException ex) {
            throw new XMLSignatureException("empty", ex);
        } catch (InvalidCanonicalizerException ex) {
View Full Code Here

Examples of org.apache.xml.security.signature.XMLSignature.sign()

        String secretKey = "secret";

        xmlSignature.getKeyInfo().addKeyName("The UTF-8 octets of \"" + secretKey
                                             + "\" are used for signing ("
                                             + secretKey.length() + " octets)");
        xmlSignature.sign(xmlSignature.createSecretKey(secretKey.getBytes()));

        FileOutputStream fos = new FileOutputStream(signatureFile);

        XMLUtils.outputDOM(doc, fos);
        fos.close();
View Full Code Here

Examples of org.apache.xml.security.signature.XMLSignature.sign()

        Transforms transforms = new Transforms(document);
        transforms.addTransform(Transforms.TRANSFORM_ENVELOPED_SIGNATURE);
        transforms.addTransform(Transforms.TRANSFORM_C14N_OMIT_COMMENTS);
        sig.addDocument("", transforms, "http://www.w3.org/2000/09/xmldsig#sha1");

        sig.sign(key);
        sig.addKeyInfo(cert);

        XMLUtils.outputDOM(document, new BufferedOutputStream(new FileOutputStream(new File(getTmpFilePath(), "signature-dom-" + tagCount + ".xml"))));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.