der

Do java.security.Key.getEncoded() return data in DER encoded format?

Do java.security.Key.getEncoded() returns data in DER encoded format? If not, is there a method that do? UPDATE: A Key interface holding an RSA private key implementation ...

Decoding incorrect(?) ASN.1 OID in an X.509 certificate

I'm writing a small utility to manually decode and extract an RSA public key from an X.509 certificate. It seems to have worked fine so far, but recently failed for a test certificate. Here's why: While decoding the ASN.1 OID, I'm expecting '2a 86 48 86 f7 0d 01 01 01', which decodes to 1.2.840.113549.1.1.1 (rsaEncryption). The certific...

How I can encrypt a string in c #?

MD5 md5 = MD5.Create(); byte[] Ostring = System.Text.Encoding.UTF8.GetBytes("original string"); byte[] hashMD5 = md5.ComputeHAsh(Ostring); StringBuilder sb = new StringBuilder(); for (int i=0; i<hashMD5.Length; i++) { sb.Append(hashMD5[i].ToString("X2")); } string strMD5 = sb.ToString(); the value of strMD5 I want encrypt it, using ...

Signing a string with RSA private key on .NET?

byte[] plaintext = System.Text.Encoding.UTF8.GetBytes("AAAAAAAAAAAAA"); TextReader trCer = new StreamReader(@"AA.key"); //key in PEM format PemReader rdCer = new PemReader(trCer); AsymmetricCipherKeyPair o = rdCer.ReadObject() as AsymmetricCipherKeyPair; ISigner sig = SignerUtilities.GetSigner("MD5WithRSAEncryption"); sig.Init(true,...

Write x509 certificate into PEM formatted string in java?

Is there some high level way to write an X509Certificate into a PEM formatted string? Currently I'm doing x509cert.encode() to write it into a DER formatted string, then base 64 encoding it and appending the header and footer to create a PEM string, but it seems bad. Especially since I have to throw in line breaks too. ...

OpenSSL PHP Function doesn't work

Hi, I'm looking for days how to translate this command to OpenSLL php function: $ openssl pkcs8 -inform DER -in aaa010101aaa_CSD_01.key -out AAA010101AAA.key.pem Enter Password: a0123456789 This work perfect, but I can't (I don't know) use the correct function of PHP OpenSSL http://www.php.net/manual/es/ref.openssl.php I have made th...