📄 pseutils.html
字号:
<BR> returns a secure random number generator that is seeded using bytes from the JRandom generator, which is itself self-seeded. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static byte[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../net/jxta/impl/membership/pse/PSEUtils.html#tlsCipher(byte[], java.lang.String, byte)">tlsCipher</A></B>(byte[] data, java.lang.String password, byte mode)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../net/jxta/impl/membership/pse/PSEUtils.html#verifySignature(java.lang.String, java.security.cert.Certificate, byte[], java.io.InputStream)">verifySignature</A></B>(java.lang.String algorithm, java.security.cert.Certificate cert, byte[] signature, java.io.InputStream stream)</CODE><BR> Verify a signature of a stream.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../net/jxta/impl/membership/pse/PSEUtils.html#verifySignedCert(java.io.File, java.io.File)">verifySignedCert</A></B>(java.io.File root, java.io.File cert)</CODE><BR> Verify a signed certificate. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../net/jxta/impl/membership/pse/PSEUtils.html#writeBase64Cert(java.io.File, java.lang.String)">writeBase64Cert</A></B>(java.io.File certFile, java.lang.String cert)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../net/jxta/impl/membership/pse/PSEUtils.html#writeBase64Object(java.io.BufferedWriter, java.lang.String, java.lang.String)">writeBase64Object</A></B>(java.io.BufferedWriter bw, java.lang.String type, java.lang.String object)</CODE><BR> Write an ovject that is already base64 encoded.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../net/jxta/impl/membership/pse/PSEUtils.html#writeCert(java.io.File, java.security.cert.Certificate)">writeCert</A></B>(java.io.File certFile, java.security.cert.Certificate cert)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../../net/jxta/impl/membership/pse/PSEUtils.html#writeObject(java.io.BufferedWriter, java.lang.String, byte[])">writeObject</A></B>(java.io.BufferedWriter out, java.lang.String type, byte[] object)</CODE><BR> </TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.Object</B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD></TR></TABLE><A NAME="PKCS5_PBSE1_ALGO"><!-- --></A><H3>PKCS5_PBSE1_ALGO</H3><PRE>static final java.lang.String <B>PKCS5_PBSE1_ALGO</B></PRE><DL><DD>We are trying to use : PBEWithMD5AndDES<P><DL><DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#net.jxta.impl.membership.pse.PSEUtils.PKCS5_PBSE1_ALGO">Constant Field Values</A></DL></DL><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="seedSRN()"><!-- --></A><H3>seedSRN</H3><PRE>public static java.security.SecureRandom <B>seedSRN</B>()</PRE><DL><DD>returns a secure random number generator that is seeded using bytes from the JRandom generator, which is itself self-seeded. If JRandom is not available then a self seeded SecureRandom is returned.<P><DD><DL><DT><B>Returns:</B><DD>a seeded SecureRandom</DL></DD></DL><HR><A NAME="readCert(java.io.File)"><!-- --></A><H3>readCert</H3><PRE>public static java.security.cert.Certificate <B>readCert</B>(java.io.File certFile) throws java.io.IOException</PRE><DL><DD>Read a certificate from the specified file.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>certFile</CODE> - File from which to read the certificate.<DT><B>Returns:</B><DD>The certificate which was read in.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="writeCert(java.io.File, java.security.cert.Certificate)"><!-- --></A><H3>writeCert</H3><PRE>public static void <B>writeCert</B>(java.io.File certFile, java.security.cert.Certificate cert) throws java.io.IOException</PRE><DL><DD><DL><DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="writeBase64Cert(java.io.File, java.lang.String)"><!-- --></A><H3>writeBase64Cert</H3><PRE>public static void <B>writeBase64Cert</B>(java.io.File certFile, java.lang.String cert) throws java.io.IOException</PRE><DL><DD><DL><DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="verifySignedCert(java.io.File, java.io.File)"><!-- --></A><H3>verifySignedCert</H3><PRE>public static boolean <B>verifySignedCert</B>(java.io.File root, java.io.File cert)</PRE><DL><DD>Verify a signed certificate. Root is an issuer cert and cert is the cert to be verified. To verify a self-signed cert, root == cert<P><DD><DL><DT><B>Parameters:</B><DD><CODE>root</CODE> - The issuer root cert.<DD><CODE>cert</CODE> - The cert to be verified.<DT><B>Returns:</B><DD>if true then the cert was verified successfully otherwise false.</DL></DD></DL><HR><A NAME="genCert(java.io.File, java.lang.String, net.jxta.impl.membership.pse.PSEUtils.IssuerInfo, java.lang.String)"><!-- --></A><H3>genCert</H3><PRE>public static <A HREF="../../../../../net/jxta/impl/membership/pse/PSEUtils.IssuerInfo.html" title="class in net.jxta.impl.membership.pse">PSEUtils.IssuerInfo</A> <B>genCert</B>(java.io.File certfile, java.lang.String cn, <A HREF="../../../../../net/jxta/impl/membership/pse/PSEUtils.IssuerInfo.html" title="class in net.jxta.impl.membership.pse">PSEUtils.IssuerInfo</A> issuer, java.lang.String passphrase) throws java.io.IOException</PRE><DL><DD>save service cert with its private key<P><DD><DL><DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="genCert(java.lang.String, net.jxta.impl.membership.pse.PSEUtils.IssuerInfo)"><!-- --></A><H3>genCert</H3><PRE>public static <A HREF="../../../../../net/jxta/impl/membership/pse/PSEUtils.IssuerInfo.html" title="class in net.jxta.impl.membership.pse">PSEUtils.IssuerInfo</A> <B>genCert</B>(java.lang.String cn, <A HREF="../../../../../net/jxta/impl/membership/pse/PSEUtils.IssuerInfo.html" title="class in net.jxta.impl.membership.pse">PSEUtils.IssuerInfo</A> issuerinfo) throws java.io.IOException</PRE><DL><DD>Generate a Cert<P><DD><DL><DT><B>Parameters:</B><DD><CODE>cn</CODE> - the X509 cn name to use.<DT><B>Returns:</B><DD>the details of the generated cert.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if the cert could not be generated or written.</DL></DD></DL><HR><A NAME="appendPrivateKey(java.io.File, net.jxta.impl.membership.pse.PSEUtils.IssuerInfo)"><!-- --></A><H3>appendPrivateKey</H3><PRE>static void <B>appendPrivateKey</B>(java.io.File certfile, <A HREF="../../../../../net/jxta/impl/membership/pse/PSEUtils.IssuerInfo.html" title="class in net.jxta.impl.membership.pse">PSEUtils.IssuerInfo</A> info) throws java.io.IOException</PRE><DL><DD>Append Encrypted RSAPrivateCrtKey to the certificate file<P><DD><DL><DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="readPrivateKey(java.io.File, java.lang.String)"><!-- --></A><H3>readPrivateKey</H3><PRE>public static java.security.PrivateKey <B>readPrivateKey</B>(java.io.File certfile, java.lang.String passphrase) throws java.io.IOException</PRE><DL><DD>load the private key from a given file.<P><DD><DL><DT><B>Returns:</B><DD>RSAPrivateKey the private key<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="computeSignature(java.lang.String, java.security.PrivateKey, java.io.InputStream)"><!-- --></A><H3>computeSignature</H3><PRE>public static byte[] <B>computeSignature</B>(java.lang.String algorithm, java.security.PrivateKey key, java.io.InputStream stream) throws java.security.InvalidKeyException, java.security.SignatureException, java.io.IOException</PRE><DL><DD>Compute the signature of a stream.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - the private key used to sign the stream<DD><CODE>stream</CODE> - the stream to sign.<DT><B>Returns:</B><DD>byte[] the signature<DT><B>Throws:</B><DD><CODE>java.security.InvalidKeyException</CODE><DD><CODE>java.security.SignatureException</CODE><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="hash(java.lang.String, byte[])"><!-- --></A><H3>hash</H3><PRE>public static byte[] <B>hash</B>(java.lang.String algorithm, byte[] data)</PRE><DL><DD>returns a hash SHA-1 of the given byte array<P><DD><DL><DT><B>Parameters:</B><DD><CODE>data</CODE> - the data to be hashed<DT><B>Returns:</B><DD>byte[] the hash of the data</DL></DD></DL><HR><A NAME="verifySignature(java.lang.String, java.security.cert.Certificate, byte[], java.io.InputStream)"><!-- --></A><H3>verifySignature</H3><PRE>public static boolean <B>verifySignature</B>(java.lang.String algorithm, java.security.cert.Certificate cert, byte[] signature, java.io.InputStream stream)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -