草庐IT

public-key

全部标签

java - 为什么 main() 在 java 中被声明为 public 和 static

这个问题在这里已经有了答案:whymainmethodcan'tbeofdefaultscope?[duplicate](9个回答)WhyistheJavamainmethodstatic?(37个答案)关闭8年前。为什么main声明为public和static?publicstaticvoidmain(Stringarg[]){}根据java中的ans"Themethodisstaticbecauseotherwisetherewouldbeambiguity:whichconstructorshouldbecalled?"

java - RSA key 对生成并存储到 keystore

我正在尝试生成RSAkey对并将其存储在HSMkeystore中。我现在拥有的代码如下所示:StringconfigName="C:\\eTokenConfig.cfg";Providerp=newsun.security.pkcs11.SunPKCS11(configName);Security.addProvider(p);//Readthekeystoreformthesmartcardchar[]pin={'p','4','s','s','w','0','r','d'};KeyStorekeyStore=KeyStore.getInstance("PKCS11",p);keyS

google-app-engine - App Engine 批量加载程序下载警告 "No descending index on __key__, performing serial download"

我正在使用以下内容下载我的一种的所有实例:appcfg.pydownload_data--config_file=bulkloader.yaml--kind=ModelName--filename=ModelName.csv--url=http://appid.appspot.com/remote_api如果种类的实例数多于批量大小,那么我会收到此警告:Nodescendingindexon__key__,performingserialdownload我没有任何自定义索引,也没有任何禁用索引的属性。我“需要”做些什么来解决这个警告,还是它只是一个我可以放心忽略的警告?会影响下载速度吗

java - 使用 BouncyCaSTLe 创建 key 对证书并使用外部 CA 对其进行签名

到目前为止,这是我为用户生成证书的内容try{Security.addProvider(newBouncyCastleProvider());//addingprovider//toStringpathtoSave="D://sureshtest.cer";KeyPairkeyPair=generateKeypair();PublicKeypublicKey=keyPair.getPublic();PrivateKeyprivateKey=keyPair.getPrivate();X509CertificatetrustCert=createCertificate(null,"CN=C

java - 我如何安全地处理 JVM 上的 key Material 缓冲区并将其归零?

我正在为执行加密操作的JVM(在Clojure中)编写软件。具体来说,给定secret输入、secretkey、非secret盐、非secret个性化,它使用BLAKE2导出512位keyMaterial。然后,它使用Arrays类中的工具将该数组分成两个256位block。(source)该操作的实际实现存在于libsodium中所以它是在C中实现的。我正在使用caesium访问它,它是kalium的包装器,一个使用jnr-ffi的库调用底层C实现。由于上面的所有缓冲区都有敏感的keyMaterial,我想确保它已从内存中清除。我不确定如何在JVM上安全地执行此操作(哎呀,我什至不确

Java 8 : Merging two Lists containing objects by key

我有两个列表:Listservers1=newArrayList();Servers1=newServer("MyServer");s1.setAttribute1("Attribute1");servers1.add(s1);Listservers2=newArrayList();Servers2=newServer("MyServer");s2.setAttribute2("Attribute2");servers2.add(s2);servers1包含具有name和attribute1(但没有attribute2)的服务器。servers2包含具有name和attribute2(

java - 除非那些内部类也被声明为静态,否则我们不能在 [public] 内部类中声明静态方法的确切原因是什么?azi

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicate:Whycantwehavestaticmethodinaninnerclass?大家好,在Java中,我们不能在[public]内部类中声明静态方法的确切原因是什么,除非这些内部类也被声明为静态的?顶级类可以拥有任意数量的静态方法而不需要任何特殊的修饰符

java - 如何解决线程 "main"com.amazonaws.AmazonClientException : Unable to build cipher: Illegal key size using aws s3 中的异常

我正在尝试使用amazonaws进行加密和解密。我遇到了异常Exceptioninthread"main"com.amazonaws.AmazonClientException:Unabletobuildcipher:IllegalkeysizeMakesureyouhavetheJCEunlimitedstrengthpolicyfilesinstalledandconfiguredforyourJVMatcom.amazonaws.services.s3.internal.crypto.ContentCryptoScheme.createCipherLite(ContentCryp

java - Hibernate Composite key Criteria Join

我正在尝试通过复合键执行多个连接。我正在使用别名来强制创建连接,但似乎连接不是由Hibernate生成的。我不知道为什么会这样。我可以让它与nativeSQL查询一起使用,但在使用条件时无法使用。我怀疑这可能与复合键定义的映射方式有关(参见BusinessServiceUser上的associationOverrides)下面是我的域模型类和查询信息。欢迎任何想法:)商务服务@Entity@Table(name="business_services")publicclassBusinessServiceextendsAbstractEntityimplementsSerializabl

java - 为什么 java.awt.Dimension 有公共(public)变量?

public变量的类在封装中被认为是弱的,这不是一个糟糕的设计实践吗?如果是这样,为什么java.awt.Dimension有2个公共(public)变量width和height? 最佳答案 我认为公开公共(public)字段并不违反封装本身。封装是实体的属性,实体内部隐藏着复杂的内部结构。这个复杂的结构不能直接访问,因此没有被破坏的风险。它只能通过公共(public)方法访问,这使得它们可以很好地工作并且不会破坏复杂的内部结构。例如,我们无法直接访问HashMap的哈希表,也无法破坏它。我们只使用get和put方法来正确处理哈希表