📄 security.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:36:03 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class Security</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Security.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../java/security/SecureRandomSpi.html"><B>PREV CLASS</B></A> <A HREF="../../java/security/SecurityPermission.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="Security.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.security</FONT><BR>Class Security</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A> | +--<B>java.security.Security</B></PRE><HR><DL><DT>public final class <B>Security</B><DT>extends <A HREF="../../java/lang/Object.html">Object</A></DL><P><p>This class centralizes all security properties and common security methods. One of its primary uses is to manage providers.<P><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Security.html#addProvider(java.security.Provider)">addProvider</A></B>(<A HREF="../../java/security/Provider.html">Provider</A> provider)</CODE><BR> Adds a provider to the next position available.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Security.html#getAlgorithmProperty(java.lang.String, java.lang.String)">getAlgorithmProperty</A></B>(<A HREF="../../java/lang/String.html">String</A> algName, <A HREF="../../java/lang/String.html">String</A> propName)</CODE><BR> <B>Deprecated.</B> <I>This method used to return the value of a proprietary property in the master file of the "SUN" Cryptographic Service Provider in order to determine how to parse algorithm-specific parameters. Use the new provider-based and algorithm-independent <code>AlgorithmParameters</code> and <code>KeyFactory</code> engine classes (introduced in the Java 2 platform) instead.</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Security.html#getProperty(java.lang.String)">getProperty</A></B>(<A HREF="../../java/lang/String.html">String</A> key)</CODE><BR> Gets a security property value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/security/Provider.html">Provider</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Security.html#getProvider(java.lang.String)">getProvider</A></B>(<A HREF="../../java/lang/String.html">String</A> name)</CODE><BR> Returns the provider installed with the specified name, if any.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/security/Provider.html">Provider</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Security.html#getProviders()">getProviders</A></B>()</CODE><BR> Returns an array containing all the installed providers.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/security/Provider.html">Provider</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Security.html#getProviders(java.util.Map)">getProviders</A></B>(<A HREF="../../java/util/Map.html">Map</A> filter)</CODE><BR> Returns an array containing all installed providers that satisfy the specified selection criteria, or null if no such providers have been installed.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/security/Provider.html">Provider</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Security.html#getProviders(java.lang.String)">getProviders</A></B>(<A HREF="../../java/lang/String.html">String</A> filter)</CODE><BR> Returns an array containing all installed providers that satisfy the specified selection criterion, or null if no such providers have been installed.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Security.html#insertProviderAt(java.security.Provider, int)">insertProviderAt</A></B>(<A HREF="../../java/security/Provider.html">Provider</A> provider, int position)</CODE><BR> Adds a new provider, at a specified position.</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="../../java/security/Security.html#removeProvider(java.lang.String)">removeProvider</A></B>(<A HREF="../../java/lang/String.html">String</A> name)</CODE><BR> Removes the provider with the specified name.</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="../../java/security/Security.html#setProperty(java.lang.String, java.lang.String)">setProperty</A></B>(<A HREF="../../java/lang/String.html">String</A> key, <A HREF="../../java/lang/String.html">String</A> datum)</CODE><BR> Sets a security property value.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html">Object</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../java/lang/Object.html#clone()">clone</A>, <A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../java/lang/Object.html#finalize()">finalize</A>, <A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="getAlgorithmProperty(java.lang.String, java.lang.String)"><!-- --></A><H3>getAlgorithmProperty</H3><PRE>public static <A HREF="../../java/lang/String.html">String</A> <B>getAlgorithmProperty</B>(<A HREF="../../java/lang/String.html">String</A> algName, <A HREF="../../java/lang/String.html">String</A> propName)</PRE><DL><DD><B>Deprecated.</B> <I>This method used to return the value of a proprietary property in the master file of the "SUN" Cryptographic Service Provider in order to determine how to parse algorithm-specific parameters. Use the new provider-based and algorithm-independent <code>AlgorithmParameters</code> and <code>KeyFactory</code> engine classes (introduced in the Java 2 platform) instead.</I><P><DD>Gets a specified property for an algorithm. The algorithm name should be a standard name. See Appendix A in the <a href= "../../../guide/security/CryptoSpec.html#AppA"> Java Cryptography Architecture API Specification & Reference </a> for information about standard algorithm names. One possible use is by specialized algorithm parsers, which may map classes to algorithms which they understand (much like Key parsers do).<DD><DL><DT><B>Parameters:</B><DD><CODE>algName</CODE> - the algorithm name.<DD><CODE>propName</CODE> - the name of the property to get.<DT><B>Returns:</B><DD>the value of the specified property.</DL></DD></DL><HR><A NAME="insertProviderAt(java.security.Provider, int)"><!-- --></A><H3>insertProviderAt</H3><PRE>public static int <B>insertProviderAt</B>(<A HREF="../../java/security/Provider.html">Provider</A> provider, int position)</PRE><DL><DD>Adds a new provider, at a specified position. The position is the preference order in which providers are searched for requested algorithms. Note that it is not guaranteed that this preference will be respected. The position is 1-based, that is, 1 is most preferred, followed by 2, and so on. <p>If the given provider is installed at the requested position, the provider that used to be at that position, and all providers with a position greater than <code>position</code>, are shifted up one position (towards the end of the list of installed providers). <p>A provider cannot be added if it is already installed. <p>First, if there is a security manager, its <code>checkSecurityAccess</code> method is called with the string <code>"insertProvider."+provider.getName()</code> to see if it's ok to add a new provider. If the default implementation of <code>checkSecurityAccess</code> is used (i.e., that method is not overriden), then this will result in a call to the security manager's <code>checkPermission</code> method with a <code>SecurityPermission("insertProvider."+provider.getName())</code> permission.<DD><DL><DT><B>Parameters:</B><DD><CODE>provider</CODE> - the provider to be added.<DD><CODE>position</CODE> - the preference position that the caller would like for this provider.<DT><B>Returns:</B><DD>the actual preference position in which the provider was added, or -1 if the provider was not added because it is already installed.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its <code><A HREF="../../java/lang/SecurityManager.html#checkSecurityAccess(java.lang.String)"><CODE>SecurityManager.checkSecurityAccess(java.lang.String)</CODE></A></code> method denies access to add a new provider<DT><B>See Also: </B><DD><A HREF="../../java/security/Security.html#getProvider(java.lang.String)"><CODE>getProvider(java.lang.String)</CODE></A>,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -