草庐IT

javax.crypto

全部标签

go - 如何使用 golang.org/x/crypto/bn256 计算 e(g1^x,g1^x)?

golang包bn256可以这样做:e(g_1^x,g_2^y),但我想计算e(g_1^x,g_1^y)。有什么办法可以把g1上的点转移到g2上吗? 最佳答案 bn256不允许您使用pair(G1,G2)进行对称配对。实现它的一种方法是将目标组元素提高到所需的指数。 关于go-如何使用golang.org/x/crypto/bn256计算e(g1^x,g1^x)?,我们在StackOverflow上找到一个类似的问题: https://stackoverflo

Golang crypto/sha256 - 相同的输入产生不同的输出

我对Golang的crypto/sha256包有疑问。我将相同的输入发送到sha256.Sum256两次,每次输出都不同。我的代码如下://RuntheHMAC-SHA256onthegivenkmacandmessageandreturnthegeneratedMACtagfuncPCSSHA256(kmac[]byte,message[]byte)[32]byte{//NOTE:bitwiseXOR^onlyworksonintegers.kmac64:=append(kmac,[]byte(strings.Repeat("0",48))[0:]...)//Padtoobtaina

python - 如何在 Python 中计算字符串的 md5,类似于 Go 中的 "crypto/md5"

我知道有hashlib在Python中,但我想获得与下面的Go中相同的结果:packagemainimport("crypto/md5""fmt")funcmain(){data:=[]byte("12345")fmt.Println("sum",md5.Sum(data))}作为funcmd5.Sum描述,它计算“数据的MD5校验和”。但是,我在Python中找不到任何类似的函数。有没有办法像在Go中那样在Python中实现md5.Sum?上面程序的输出是一个slice而不是一个字符串:sum[3244185981728979115075721453575112]

go - crypto/autocert 包停止工作,永远挂起等待 acme 挑战

我一直依赖这个库有一段时间了,没有任何问题,但突然间它完全忽略了缓存的证书,尝试获取新证书,但它只是永远等待显然永远不会出现的acme挑战。据我所知,我的用法是完全正确的(这在过去几周内一直有效,没有问题):certManager:=autocert.Manager{Prompt:autocert.AcceptTOS,HostPolicy:autocert.HostWhitelist("example.com"),Cache:autocert.DirCache("certs"),}c1:=make(chanerror)gofunc(){err:=http.ListenAndServe(

Go dep 不解析 "golang.org/x/crypto"

我不是很熟悉godep(一般也不熟悉golang),但我继承了一个项目,我需要在其中添加依赖项。运行depensure-v时,我得到以下输出:Rootprojectis"github.com/MyOrg/myProject"7transitivelyvalidinternalpackages8externalpackagesimportedfrom8projects(0)✓select(root)(1)?attemptgithub.com/MyOrg/protowith1pkgs;atleast1versionstotry(1)trygithub.com/MyOrg/proto@v0.

golang.org/x/crypto/bcrypt 生成哈希时的错误案例

这是使用bcrypt生成散列密码的函数funcGenerateFromPassword(password[]byte,costint)([]byte,错误)GenerateFromPasswordreturnsthebcrypthashofthepasswordatthegivencost.IfthecostgivenislessthanMinCost,thecostwillbesettoDefaultCost,instead.UseCompareHashAndPassword,asdefinedinthispackage,tocomparethereturnedhashedpassw

xml - 使用 JAXB 时出现 java.net.MalformedURLException : no protocol with javax. xml.stream.XMLStreamException

我正在使用JAXB解码XML文档。在解析XML时,它会抛出一个用XMLStreamException包装的MalformedURLException。我的理解是在创建XMLStreamReader对象本身时它抛出了异常。有什么建议吗?我使用的代码片段:XMLInputFactoryxif=XMLInputFactory.newFactory();XMLResolverresolver=newXMLResolver();//tocapturesystemID,baseURIetc.xif.setXMLResolver(resolver);//ThrowsMalformedURLExcep

此上下文已知 javax.xml.bind.MarshalException 及其任何父类(super class)

我遇到了异常,正在寻找解决方案,我们将不胜感激。在其他一些消息中发现了同样的问题,但它们对我不起作用。请看下面的代码。javax.xml.bind.MarshalException-withlinkedexception:[com.sun.istack.SAXException2:classcom.mycompany.soma.ws.rest.v1.model.test.EmployeeConstructionnoranyofitssuperclassisknowntothiscontext.javax.xml.bind.JAXBException:classcom.mycompany

java - axis2 导致 javax.xml.stream.XMLStreamException : element text content may not contain START_ELEMENT

我通过eclipse生成了一个axis2web服务客户端。我总是在执行时遇到这个错误。org.apache.axis2.AxisFault:javax.xml.stream.XMLStreamException:elementtextcontentmaynotcontainSTART_ELEMENT在我的wsdl中在调试调用时我可以看到响应是Rxxxxxx2016-02-0612:02:53-12xxxxxxxxxxxxxxxx关于java.lang.Stringcontent=reader.getElementText();抛出异常javax.xml.stream.XMLStream

java - SAXNotRecognizedException : Feature 'http://javax.xml.XMLConstants/feature/secure-processing' not recognized

我在解码类时收到此错误。我正在使用Amazon的mTurks以及Spring、Maven和(惊喜,惊喜)一个xerces问题已经引起了它的注意。我以多种不同的方式使用POM来尝试解决问题,但我似乎无法找出解决方案。我正在使用在这里找到的mturks的mavenized版本:https://github.com/tc/java-aws-mturk我已经明确地从mturks中排除了xerces的东西:com.amazonjava-aws-mturk1.2.2commons-langcommons-langapache-xercesxercesImplapache-xercesresolve