You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by de...@apache.org on 2007/01/06 21:36:10 UTC
svn commit: r493566 - in /jakarta/commons/sandbox/openpgp/trunk/src:
main/java/org/apache/commons/openpgp/ant/
main/resources/org/apache/commons/openpgp/ant/ site/ site/apt/
Author: dennisl
Date: Sat Jan 6 12:36:09 2007
New Revision: 493566
URL: http://svn.apache.org/viewvc?view=rev&rev=493566
Log:
Set EOL-style to native.
Modified:
jakarta/commons/sandbox/openpgp/trunk/src/main/java/org/apache/commons/openpgp/ant/OpenPgpSignerTask.java (contents, props changed)
jakarta/commons/sandbox/openpgp/trunk/src/main/resources/org/apache/commons/openpgp/ant/antlib.xml (contents, props changed)
jakarta/commons/sandbox/openpgp/trunk/src/site/apt/index.apt (contents, props changed)
jakarta/commons/sandbox/openpgp/trunk/src/site/apt/signer.apt (contents, props changed)
jakarta/commons/sandbox/openpgp/trunk/src/site/apt/usage.apt (contents, props changed)
jakarta/commons/sandbox/openpgp/trunk/src/site/site.xml (props changed)
Modified: jakarta/commons/sandbox/openpgp/trunk/src/main/java/org/apache/commons/openpgp/ant/OpenPgpSignerTask.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/openpgp/trunk/src/main/java/org/apache/commons/openpgp/ant/OpenPgpSignerTask.java?view=diff&rev=493566&r1=493565&r2=493566
==============================================================================
--- jakarta/commons/sandbox/openpgp/trunk/src/main/java/org/apache/commons/openpgp/ant/OpenPgpSignerTask.java (original)
+++ jakarta/commons/sandbox/openpgp/trunk/src/main/java/org/apache/commons/openpgp/ant/OpenPgpSignerTask.java Sat Jan 6 12:36:09 2007
@@ -1,215 +1,215 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.openpgp.ant;
-
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.util.FileNameMapper;
-import org.apache.tools.ant.util.GlobPatternMapper;
-import org.apache.tools.ant.util.FileUtils;
-import org.apache.tools.ant.types.FileSet;
-import org.apache.tools.ant.types.Mapper;
-import org.apache.commons.openpgp.*;
-import org.bouncycastle.openpgp.PGPException;
-
-import java.io.*;
-import java.util.Collection;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-/**
- */
-public class OpenPgpSignerTask extends Task {
- private File secring;
- private File pubring;
- private String password;
- private String keyId;
- private Collection tosign = new ArrayList();
- private File artefact;
- private boolean asciiarmor = true;
- private Mapper mapperElement;
-
- /**
- * set the secret keyring
- * @param secring secret keyring file
- */
- public void setSecring(File secring) {
- this.secring = secring;
- }
-
- /**
- * set the public keyring
- * @param pubring public keyring file
- */
- public void setPubring(File pubring) {
- this.pubring = pubring;
- }
-
- /**
- * set the key id
- * @param keyId
- */
- public void setKeyId(String keyId) {
- this.keyId = keyId;
- }
-
- /**
- * asciiarmor the signature ?
- * @param asciiarmor ascii armored signature ?
- */
- public void setAsciiarmor(boolean asciiarmor) {
- this.asciiarmor = asciiarmor;
- }
-
- /**
- * set the value of the password
- * @param password value of the password
- */
- public void setPassword(String password) {
- this.password = password;
- }
-
- /**
- * artefact to be signed
- * @param artefact artefact to be signed
- */
- public void setArtefact(File artefact) {
- this.artefact = artefact;
- }
-
-
- public void add(FileSet fs) {
- tosign.add(fs);
- }
-
- /**
- * Define the mapper to map source to destination files.
- * @return a mapper to be configured.
- * @exception org.apache.tools.ant.BuildException if more than one mapper is defined.
- */
- public Mapper createMapper() throws BuildException {
- if (mapperElement != null) {
- throw new BuildException("Cannot define more than one mapper",
- getLocation());
- }
- mapperElement = new Mapper(getProject());
- return mapperElement;
- }
-
- public void execute() {
- if (secring == null) {
- throw new BuildException("secring attribute compulsory");
- }
- if (pubring == null) {
- throw new BuildException("pubring attribute compulsory");
- }
- if (password == null) {
- throw new BuildException("password attribute compulsory");
- }
- if (tosign.size() == 0 && artefact == null) {
- throw new BuildException("supply the attribute tosign or one nested fileset");
- }
- if (!secring.exists() || !secring.canRead()) {
- throw new BuildException("secret keyring file does not exist or is not readable");
- }
- if (!pubring.exists() || !pubring.canRead()) {
- throw new BuildException("public keyring file does not exist or is not readable");
- }
- FileInputStream secStream;
- FileInputStream pubStream;
- KeyRing keyRing = null;
- try {
- secStream = new FileInputStream(secring);
- pubStream = new FileInputStream(pubring);
- keyRing = new BouncyCastleKeyRing(secStream,
- pubStream, password.toCharArray() );
- } catch (IOException ioe) {
- throw new BuildException(ioe);
- } catch (PGPException pgpe) {
- throw new BuildException(pgpe);
- }
- if (artefact != null) {
- dosign(keyRing, artefact);
- }
- if (tosign.size() != 0) {
- for (Iterator it = tosign.iterator(); it.hasNext(); ) {
- FileSet fs = (FileSet) it.next();
- dosign(keyRing, fs);
- }
- }
- FileUtils.close(secStream);
- FileUtils.close(pubStream);
- }
- private void dosign(KeyRing keyRing, FileSet fs) {
- DirectoryScanner ds = fs.getDirectoryScanner(getProject());
- String[] artefacts = ds.getIncludedFiles();
- for (int counter = 0; counter < artefacts.length; counter++) {
- dosign(keyRing,
- new File(fs.getDir(getProject()), artefacts[counter]), fs.getDir(getProject()), artefacts[counter]);
- }
- }
- private void dosign(KeyRing keyRing, File oneartefact) {
- dosign(keyRing, oneartefact, oneartefact.getParentFile(), oneartefact.getName());
- }
- private void dosign(KeyRing keyRing, File oneartefact, File basedir, String relpath) {
- FileInputStream fis = null;
- FileOutputStream fos = null;
- File signature;
-
- try {
- fis = new FileInputStream(oneartefact);
- FileNameMapper mapper = getMapper();
- String [] mappedFiles = mapper.mapFileName(relpath);
- if (mappedFiles == null || mappedFiles.length != 1) {
- throw new BuildException("mapper returned more or less than one output");
- }
- signature = new File(basedir, mappedFiles[0]);
- fos = new FileOutputStream(signature);
- OpenPgpSigner signer = new BouncyCastleOpenPgpSigner();
- signer.detachedSign(fis, fos, keyId, keyRing, asciiarmor);
- } catch (FileNotFoundException fnfe) {
- throw new BuildException(fnfe);
- } catch (IOException ioe) {
- throw new BuildException(ioe);
- } catch (OpenPgpException opgpe) {
- throw new BuildException(opgpe);
- }
- FileUtils.close(fos);
- FileUtils.close(fis);
-
- }
- /**
- * returns the mapper to use based on nested elements or the
- */
- private FileNameMapper getMapper() {
- FileNameMapper mapper = null;
- if (mapperElement != null) {
- mapper = mapperElement.getImplementation();
- } else {
- mapper = new GlobPatternMapper();
- mapper.setFrom("*");
- if (asciiarmor) {
- mapper.setTo("*.asc");
- } else {
- mapper.setTo("*.sig");
- }
- }
- return mapper;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.openpgp.ant;
+
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.util.FileNameMapper;
+import org.apache.tools.ant.util.GlobPatternMapper;
+import org.apache.tools.ant.util.FileUtils;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Mapper;
+import org.apache.commons.openpgp.*;
+import org.bouncycastle.openpgp.PGPException;
+
+import java.io.*;
+import java.util.Collection;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ */
+public class OpenPgpSignerTask extends Task {
+ private File secring;
+ private File pubring;
+ private String password;
+ private String keyId;
+ private Collection tosign = new ArrayList();
+ private File artefact;
+ private boolean asciiarmor = true;
+ private Mapper mapperElement;
+
+ /**
+ * set the secret keyring
+ * @param secring secret keyring file
+ */
+ public void setSecring(File secring) {
+ this.secring = secring;
+ }
+
+ /**
+ * set the public keyring
+ * @param pubring public keyring file
+ */
+ public void setPubring(File pubring) {
+ this.pubring = pubring;
+ }
+
+ /**
+ * set the key id
+ * @param keyId
+ */
+ public void setKeyId(String keyId) {
+ this.keyId = keyId;
+ }
+
+ /**
+ * asciiarmor the signature ?
+ * @param asciiarmor ascii armored signature ?
+ */
+ public void setAsciiarmor(boolean asciiarmor) {
+ this.asciiarmor = asciiarmor;
+ }
+
+ /**
+ * set the value of the password
+ * @param password value of the password
+ */
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ /**
+ * artefact to be signed
+ * @param artefact artefact to be signed
+ */
+ public void setArtefact(File artefact) {
+ this.artefact = artefact;
+ }
+
+
+ public void add(FileSet fs) {
+ tosign.add(fs);
+ }
+
+ /**
+ * Define the mapper to map source to destination files.
+ * @return a mapper to be configured.
+ * @exception org.apache.tools.ant.BuildException if more than one mapper is defined.
+ */
+ public Mapper createMapper() throws BuildException {
+ if (mapperElement != null) {
+ throw new BuildException("Cannot define more than one mapper",
+ getLocation());
+ }
+ mapperElement = new Mapper(getProject());
+ return mapperElement;
+ }
+
+ public void execute() {
+ if (secring == null) {
+ throw new BuildException("secring attribute compulsory");
+ }
+ if (pubring == null) {
+ throw new BuildException("pubring attribute compulsory");
+ }
+ if (password == null) {
+ throw new BuildException("password attribute compulsory");
+ }
+ if (tosign.size() == 0 && artefact == null) {
+ throw new BuildException("supply the attribute tosign or one nested fileset");
+ }
+ if (!secring.exists() || !secring.canRead()) {
+ throw new BuildException("secret keyring file does not exist or is not readable");
+ }
+ if (!pubring.exists() || !pubring.canRead()) {
+ throw new BuildException("public keyring file does not exist or is not readable");
+ }
+ FileInputStream secStream;
+ FileInputStream pubStream;
+ KeyRing keyRing = null;
+ try {
+ secStream = new FileInputStream(secring);
+ pubStream = new FileInputStream(pubring);
+ keyRing = new BouncyCastleKeyRing(secStream,
+ pubStream, password.toCharArray() );
+ } catch (IOException ioe) {
+ throw new BuildException(ioe);
+ } catch (PGPException pgpe) {
+ throw new BuildException(pgpe);
+ }
+ if (artefact != null) {
+ dosign(keyRing, artefact);
+ }
+ if (tosign.size() != 0) {
+ for (Iterator it = tosign.iterator(); it.hasNext(); ) {
+ FileSet fs = (FileSet) it.next();
+ dosign(keyRing, fs);
+ }
+ }
+ FileUtils.close(secStream);
+ FileUtils.close(pubStream);
+ }
+ private void dosign(KeyRing keyRing, FileSet fs) {
+ DirectoryScanner ds = fs.getDirectoryScanner(getProject());
+ String[] artefacts = ds.getIncludedFiles();
+ for (int counter = 0; counter < artefacts.length; counter++) {
+ dosign(keyRing,
+ new File(fs.getDir(getProject()), artefacts[counter]), fs.getDir(getProject()), artefacts[counter]);
+ }
+ }
+ private void dosign(KeyRing keyRing, File oneartefact) {
+ dosign(keyRing, oneartefact, oneartefact.getParentFile(), oneartefact.getName());
+ }
+ private void dosign(KeyRing keyRing, File oneartefact, File basedir, String relpath) {
+ FileInputStream fis = null;
+ FileOutputStream fos = null;
+ File signature;
+
+ try {
+ fis = new FileInputStream(oneartefact);
+ FileNameMapper mapper = getMapper();
+ String [] mappedFiles = mapper.mapFileName(relpath);
+ if (mappedFiles == null || mappedFiles.length != 1) {
+ throw new BuildException("mapper returned more or less than one output");
+ }
+ signature = new File(basedir, mappedFiles[0]);
+ fos = new FileOutputStream(signature);
+ OpenPgpSigner signer = new BouncyCastleOpenPgpSigner();
+ signer.detachedSign(fis, fos, keyId, keyRing, asciiarmor);
+ } catch (FileNotFoundException fnfe) {
+ throw new BuildException(fnfe);
+ } catch (IOException ioe) {
+ throw new BuildException(ioe);
+ } catch (OpenPgpException opgpe) {
+ throw new BuildException(opgpe);
+ }
+ FileUtils.close(fos);
+ FileUtils.close(fis);
+
+ }
+ /**
+ * returns the mapper to use based on nested elements or the
+ */
+ private FileNameMapper getMapper() {
+ FileNameMapper mapper = null;
+ if (mapperElement != null) {
+ mapper = mapperElement.getImplementation();
+ } else {
+ mapper = new GlobPatternMapper();
+ mapper.setFrom("*");
+ if (asciiarmor) {
+ mapper.setTo("*.asc");
+ } else {
+ mapper.setTo("*.sig");
+ }
+ }
+ return mapper;
+ }
+
+}
Propchange: jakarta/commons/sandbox/openpgp/trunk/src/main/java/org/apache/commons/openpgp/ant/OpenPgpSignerTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jakarta/commons/sandbox/openpgp/trunk/src/main/resources/org/apache/commons/openpgp/ant/antlib.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/openpgp/trunk/src/main/resources/org/apache/commons/openpgp/ant/antlib.xml?view=diff&rev=493566&r1=493565&r2=493566
==============================================================================
--- jakarta/commons/sandbox/openpgp/trunk/src/main/resources/org/apache/commons/openpgp/ant/antlib.xml (original)
+++ jakarta/commons/sandbox/openpgp/trunk/src/main/resources/org/apache/commons/openpgp/ant/antlib.xml Sat Jan 6 12:36:09 2007
@@ -1,6 +1,6 @@
-<?xml version="1.0"?>
-<antlib>
- <taskdef name="signer"
- classname="org.apache.commons.openpgp.ant.OpenPgpSignerTask"
- />
+<?xml version="1.0"?>
+<antlib>
+ <taskdef name="signer"
+ classname="org.apache.commons.openpgp.ant.OpenPgpSignerTask"
+ />
</antlib>
Propchange: jakarta/commons/sandbox/openpgp/trunk/src/main/resources/org/apache/commons/openpgp/ant/antlib.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jakarta/commons/sandbox/openpgp/trunk/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/openpgp/trunk/src/site/apt/index.apt?view=diff&rev=493566&r1=493565&r2=493566
==============================================================================
--- jakarta/commons/sandbox/openpgp/trunk/src/site/apt/index.apt (original)
+++ jakarta/commons/sandbox/openpgp/trunk/src/site/apt/index.apt Sat Jan 6 12:36:09 2007
@@ -1,27 +1,27 @@
- -----
- Jakarta Commons OpenPGP
- -----
- Brett Porter
- -----
- 10 December 2005
- -----
-
-Jakarta Commons OpenPGP
-
- Commons OpenPGP was started to produce a common and simple interface for generating
- and verifying OpenPGP signatures.
-
- Currently implemented using {{{http://www.bouncycastle.org} BouncyCastle}}, it is
- intended to allow pluggable providers so that alternate open source and commercial
- providers can be used.
-
-* History
-
- The library was started by Maven and Ant committers to enable the use of OpenPGP
- from these tools. Currently, Maven uses it in its development version to sign
- libraries released to the repository.
-
-* Using the Library
-
- * {{{usage.html} Usage Instructions}}
-
+ -----
+ Jakarta Commons OpenPGP
+ -----
+ Brett Porter
+ -----
+ 10 December 2005
+ -----
+
+Jakarta Commons OpenPGP
+
+ Commons OpenPGP was started to produce a common and simple interface for generating
+ and verifying OpenPGP signatures.
+
+ Currently implemented using {{{http://www.bouncycastle.org} BouncyCastle}}, it is
+ intended to allow pluggable providers so that alternate open source and commercial
+ providers can be used.
+
+* History
+
+ The library was started by Maven and Ant committers to enable the use of OpenPGP
+ from these tools. Currently, Maven uses it in its development version to sign
+ libraries released to the repository.
+
+* Using the Library
+
+ * {{{usage.html} Usage Instructions}}
+
Propchange: jakarta/commons/sandbox/openpgp/trunk/src/site/apt/index.apt
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jakarta/commons/sandbox/openpgp/trunk/src/site/apt/signer.apt
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/openpgp/trunk/src/site/apt/signer.apt?view=diff&rev=493566&r1=493565&r2=493566
==============================================================================
--- jakarta/commons/sandbox/openpgp/trunk/src/site/apt/signer.apt (original)
+++ jakarta/commons/sandbox/openpgp/trunk/src/site/apt/signer.apt Sat Jan 6 12:36:09 2007
@@ -1,55 +1,55 @@
-Signer Ant Task
-
-This task will be packaged in the commons-openpgp.jar.
-It will use the bouncy castle jars at runtime. It has been tested with bcpg-jdk12-134.jar and bcprov-jdk12-134.jar.
-The generated signatures can be verified with gpg.
-
-<<<signer>>> can sign one or several files at once.
-
-* <<<attributes>>>
-
-
-*------------------+--------------------------------------------------------------------------+-------------------------------------------------+
-| Attribute | Description | Required |
-*------------------+--------------------------------------------------------------------------+-------------------------------------------------+
-| <<<secring>>> | Secret key ring file. | Yes |
-*------------------+--------------------------------------------------------------------------+-------------------------------------------------+
-| <<<pubring>>> | Public key ring file. | Yes |
-*------------------+--------------------------------------------------------------------------+-------------------------------------------------+
-| <<<password>>> | Password of the secret key ring. | Yes |
-*------------------+--------------------------------------------------------------------------+-------------------------------------------------+
-| <<<keyid>>> | Id of the key used to sign. | Yes |
-*------------------+--------------------------------------------------------------------------+-------------------------------------------------+
-| <<<asciiarmor>>> | Boolean, defaults to true. | No |
-*------------------+--------------------------------------------------------------------------+-------------------------------------------------+
-| <<<artefact>>> | The file that you want to sign. | No, if fileset nested element present. |
-*------------------+--------------------------------------------------------------------------+-------------------------------------------------+
-
- The task must also take a either one or several nested <<<fileset>>> element, or an <<<artefact>>> attribute.
-
-** <<<fileset>>> nested element
-
- The task can take one or several fileset nested elements.
- See the {{{http://ant.apache.org/manual/CoreTypes/fileset.html} ant manual}} for an explanation.
- If you want to sign just one file, the <<<artefact>>> attribute can be used instead.
-
-** <<<mapper>>> nested element
-
- The task may take a {{{http://ant.apache.org/manual/CoreTypes/mapper.html} mapper}} nested element.
- This nested element tells the task how the signature files should be called.
- If you do not supply this element, the signature files will be located in the same directory as the files that
- you sign. An ending of <<<.asc>>> will be appended to the file name for ascii armored output (the default).
- If you set <<<asciiarmor>>> to false, the ending will be <<<.sig>>>
-
-
-* example
------
-<project name="test1" xmlns:openpgp="antlib:org.apache.commons.openpgp.ant">
- <taskdef resource="org/apache/commons/openpgp/ant/antlib.xml" uri="antlib:org.apache.commons.openpgp.ant"/>
- <openpgp:signer secring="${env.USERPROFILE}\Application Data\gnupg\secring.gpg"
- pubring="${env.USERPROFILE}\Application Data\gnupg\pubring.gpg"
- password="secret" keyid="12345678"
- artefact="target\commons-openpgp-1.0-SNAPSHOT.jar"
- asciiarmor="true"/>
-</project>
------
+Signer Ant Task
+
+This task will be packaged in the commons-openpgp.jar.
+It will use the bouncy castle jars at runtime. It has been tested with bcpg-jdk12-134.jar and bcprov-jdk12-134.jar.
+The generated signatures can be verified with gpg.
+
+<<<signer>>> can sign one or several files at once.
+
+* <<<attributes>>>
+
+
+*------------------+--------------------------------------------------------------------------+-------------------------------------------------+
+| Attribute | Description | Required |
+*------------------+--------------------------------------------------------------------------+-------------------------------------------------+
+| <<<secring>>> | Secret key ring file. | Yes |
+*------------------+--------------------------------------------------------------------------+-------------------------------------------------+
+| <<<pubring>>> | Public key ring file. | Yes |
+*------------------+--------------------------------------------------------------------------+-------------------------------------------------+
+| <<<password>>> | Password of the secret key ring. | Yes |
+*------------------+--------------------------------------------------------------------------+-------------------------------------------------+
+| <<<keyid>>> | Id of the key used to sign. | Yes |
+*------------------+--------------------------------------------------------------------------+-------------------------------------------------+
+| <<<asciiarmor>>> | Boolean, defaults to true. | No |
+*------------------+--------------------------------------------------------------------------+-------------------------------------------------+
+| <<<artefact>>> | The file that you want to sign. | No, if fileset nested element present. |
+*------------------+--------------------------------------------------------------------------+-------------------------------------------------+
+
+ The task must also take a either one or several nested <<<fileset>>> element, or an <<<artefact>>> attribute.
+
+** <<<fileset>>> nested element
+
+ The task can take one or several fileset nested elements.
+ See the {{{http://ant.apache.org/manual/CoreTypes/fileset.html} ant manual}} for an explanation.
+ If you want to sign just one file, the <<<artefact>>> attribute can be used instead.
+
+** <<<mapper>>> nested element
+
+ The task may take a {{{http://ant.apache.org/manual/CoreTypes/mapper.html} mapper}} nested element.
+ This nested element tells the task how the signature files should be called.
+ If you do not supply this element, the signature files will be located in the same directory as the files that
+ you sign. An ending of <<<.asc>>> will be appended to the file name for ascii armored output (the default).
+ If you set <<<asciiarmor>>> to false, the ending will be <<<.sig>>>
+
+
+* example
+-----
+<project name="test1" xmlns:openpgp="antlib:org.apache.commons.openpgp.ant">
+ <taskdef resource="org/apache/commons/openpgp/ant/antlib.xml" uri="antlib:org.apache.commons.openpgp.ant"/>
+ <openpgp:signer secring="${env.USERPROFILE}\Application Data\gnupg\secring.gpg"
+ pubring="${env.USERPROFILE}\Application Data\gnupg\pubring.gpg"
+ password="secret" keyid="12345678"
+ artefact="target\commons-openpgp-1.0-SNAPSHOT.jar"
+ asciiarmor="true"/>
+</project>
+-----
Propchange: jakarta/commons/sandbox/openpgp/trunk/src/site/apt/signer.apt
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jakarta/commons/sandbox/openpgp/trunk/src/site/apt/usage.apt
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/openpgp/trunk/src/site/apt/usage.apt?view=diff&rev=493566&r1=493565&r2=493566
==============================================================================
--- jakarta/commons/sandbox/openpgp/trunk/src/site/apt/usage.apt (original)
+++ jakarta/commons/sandbox/openpgp/trunk/src/site/apt/usage.apt Sat Jan 6 12:36:09 2007
@@ -1,109 +1,109 @@
- -----
- Commons OpenPGP - Usage
- -----
- Brett Porter
- -----
- 10 December 2005
- -----
-
-Usage Instructions
-
- Currently only creation and verification of detached signatures is supported. This can be done in streaming and
- non-streaming mode.
-
- Both modes require that you have created a key ring.
-
-* Creating a Key Ring
-
- A key ring object needs to be created, containing an input stream for both the public and secret key rings.
- The password for the secret key ring also needs to be passed in for creating signatures.
-
- For example, to create the Bouncy Castle key ring, the constructor is used:
-
------
-BouncyCastleKeyRing( InputStream secretKeyRing, InputStream publicKeyRing, char[] password );
------
-
-* Non-streaming Mode
-
- ~~TODO: link to Javadoc
-
- To sign data with a detached signature, create a <<<OpenPgpSigner>>>.
-
------
-signer = new BouncyCastleOpenPgpSigner();
-
-signer.detachedSign(
- getClass().getResourceAsStream( "/test-input" ), // binary input file
- signature, // outputstream for the signature
- keyId, // key ID
- keyRing,
- true ); // ascii armor
------
-
- Verifying the signature is similar.
-
------
-verifier = new BouncyCastleOpenPgpSignatureVerifier();
-
-verifier.verifyDetachedSignature(
- getClass().getResourceAsStream( "/test-input" ), // binary input file
- signature, // inputstream for the signature
- keyRing,
- true ); // ascii armor
------
-
-* Streaming Mode
-
- ~~TODO: link to Javadoc
-
- To sign data in streaming mode, create an instance of <<<OpenPgpStreamingSigner>>>.
-
- The <<<update()>>> method is called on blocks of data to update the signautre. Finally, <<<finish()>>> is called
- to receive the detached signature as a byte array.
-
------
-signer = new BouncyCastleOpenPgpStreamingSigner(
- new FileOutputStream( "file.asc" ), // detached signature
- "ABC123D", // key ID
- keyRing,
- true ); // ascii armor?
-
-int len;
-do
-{
- len = read( buf );
- if ( len > 0 )
- {
- signer.update( buf );
- }
-}
-while ( len >= 0 );
-
-byte[] signature = signer.finish();
------
-
- To verify a signature in streaming mode is similar.
-
------
-verifier = new BouncyCastleOpenPgpStreamingSignatureVerifier(
- new FileInputStream( "file.asc" ), // detached signature
- keyRing,
- true ); // ascii armor?
-
-int len;
-do
-{
- len = read( buf );
- if ( len > 0 )
- {
- verifier.update( buf );
- }
-}
-while ( len >= 0 );
-
-SignatureStatus status = verifier.finish();
------
-
- The <<<SignatureStatus>>> returned indicates whether the signature was valid and whether it was trusted.
-
+ -----
+ Commons OpenPGP - Usage
+ -----
+ Brett Porter
+ -----
+ 10 December 2005
+ -----
+
+Usage Instructions
+
+ Currently only creation and verification of detached signatures is supported. This can be done in streaming and
+ non-streaming mode.
+
+ Both modes require that you have created a key ring.
+
+* Creating a Key Ring
+
+ A key ring object needs to be created, containing an input stream for both the public and secret key rings.
+ The password for the secret key ring also needs to be passed in for creating signatures.
+
+ For example, to create the Bouncy Castle key ring, the constructor is used:
+
+-----
+BouncyCastleKeyRing( InputStream secretKeyRing, InputStream publicKeyRing, char[] password );
+-----
+
+* Non-streaming Mode
+
+ ~~TODO: link to Javadoc
+
+ To sign data with a detached signature, create a <<<OpenPgpSigner>>>.
+
+-----
+signer = new BouncyCastleOpenPgpSigner();
+
+signer.detachedSign(
+ getClass().getResourceAsStream( "/test-input" ), // binary input file
+ signature, // outputstream for the signature
+ keyId, // key ID
+ keyRing,
+ true ); // ascii armor
+-----
+
+ Verifying the signature is similar.
+
+-----
+verifier = new BouncyCastleOpenPgpSignatureVerifier();
+
+verifier.verifyDetachedSignature(
+ getClass().getResourceAsStream( "/test-input" ), // binary input file
+ signature, // inputstream for the signature
+ keyRing,
+ true ); // ascii armor
+-----
+
+* Streaming Mode
+
+ ~~TODO: link to Javadoc
+
+ To sign data in streaming mode, create an instance of <<<OpenPgpStreamingSigner>>>.
+
+ The <<<update()>>> method is called on blocks of data to update the signautre. Finally, <<<finish()>>> is called
+ to receive the detached signature as a byte array.
+
+-----
+signer = new BouncyCastleOpenPgpStreamingSigner(
+ new FileOutputStream( "file.asc" ), // detached signature
+ "ABC123D", // key ID
+ keyRing,
+ true ); // ascii armor?
+
+int len;
+do
+{
+ len = read( buf );
+ if ( len > 0 )
+ {
+ signer.update( buf );
+ }
+}
+while ( len >= 0 );
+
+byte[] signature = signer.finish();
+-----
+
+ To verify a signature in streaming mode is similar.
+
+-----
+verifier = new BouncyCastleOpenPgpStreamingSignatureVerifier(
+ new FileInputStream( "file.asc" ), // detached signature
+ keyRing,
+ true ); // ascii armor?
+
+int len;
+do
+{
+ len = read( buf );
+ if ( len > 0 )
+ {
+ verifier.update( buf );
+ }
+}
+while ( len >= 0 );
+
+SignatureStatus status = verifier.finish();
+-----
+
+ The <<<SignatureStatus>>> returned indicates whether the signature was valid and whether it was trusted.
+
Propchange: jakarta/commons/sandbox/openpgp/trunk/src/site/apt/usage.apt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/sandbox/openpgp/trunk/src/site/site.xml
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org