You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by og...@apache.org on 2009/04/02 05:36:14 UTC
svn commit: r761156 - in
/maven/mercury/trunk/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/pgp:
Messages.properties PgpHelper.java
Author: ogusakov
Date: Thu Apr 2 03:36:13 2009
New Revision: 761156
URL: http://svn.apache.org/viewvc?rev=761156&view=rev
Log:
improving PGP utilities
Modified:
maven/mercury/trunk/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/pgp/Messages.properties
maven/mercury/trunk/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/pgp/PgpHelper.java
Modified: maven/mercury/trunk/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/pgp/Messages.properties
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/pgp/Messages.properties?rev=761156&r1=761155&r2=761156&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/pgp/Messages.properties (original)
+++ maven/mercury/trunk/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/pgp/Messages.properties Thu Apr 2 03:36:13 2009
@@ -40,3 +40,6 @@
no.trusted.ring=trusted ring seem to be empty. There is no one I can trust, so signature verification is pointless.
no.signature.string=there is signature supplied, so signature verification is pointless.
+null.ring=public ring cannot be null
+
+null.os=output stream cannot be null
\ No newline at end of file
Modified: maven/mercury/trunk/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/pgp/PgpHelper.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/pgp/PgpHelper.java?rev=761156&r1=761155&r2=761156&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/pgp/PgpHelper.java (original)
+++ maven/mercury/trunk/mercury-crypto/mercury-crypto-basic/src/main/java/org/apache/maven/mercury/crypto/pgp/PgpHelper.java Thu Apr 2 03:36:13 2009
@@ -22,6 +22,7 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import java.math.BigInteger;
import java.security.Security;
import java.util.Iterator;
@@ -33,6 +34,7 @@
import org.bouncycastle.openpgp.PGPCompressedData;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPObjectFactory;
+import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
import org.bouncycastle.openpgp.PGPSecretKey;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
@@ -201,6 +203,30 @@
return verified;
}
+
+ public static final PGPPublicKeyRingCollection readPublicRing( InputStream in )
+ throws IOException, PGPException
+ {
+ if( in == null )
+ return null;
+
+ PGPPublicKeyRingCollection res = new PGPPublicKeyRingCollection( PGPUtil.getDecoderStream( in ) );
+
+ return res;
+ }
+
+ public static final void writePublicRing( PGPPublicKeyRingCollection prc, OutputStream out )
+ throws IOException
+ {
+ if( prc == null )
+ throw new IllegalArgumentException( LANG.getMessage( "null.ring" ) );
+
+ if( out == null )
+ throw new IllegalArgumentException( LANG.getMessage( "null.os" ) );
+
+ prc.encode( out );
+
+ }
//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
}