Re: how to get CKA_PRIVATE_EXPONENT attribute from a private key?

2012-02-02 Thread weizhong qiang
hi, I solved the problem by generating the key pair with isPerm to be PR_FALSE, and then importing the private key using PK11_ImportDERPrivateKeyInfoAndReturnKey. Best Regards, Weizhong Qiang On Jan 31, 2012, at 7:28 AM, weizhong qiang wrote: hi Robert and others, See the attachment for

Re: how to get CKA_PRIVATE_EXPONENT attribute from a private key?

2012-01-30 Thread weizhong qiang
hi Robert and others, See the attachment for more complete test case of generating and reading a key. I found if I set the isPerm parameter to be PR_FALSE (see line 78 of the test case), the private key is not sensitive. If I set the isPerm parameter to be PR_TRUE, then not mater the IsSensitive

Re: how to get CKA_PRIVATE_EXPONENT attribute from a private key?

2012-01-28 Thread weizhong qiang
hi, On Jan 27, 2012, at 6:41 PM, Robert Relyea wrote: On 01/26/2012 06:50 PM, weizhong qiang wrote: hi, On Jan 26, 2012, at 6:28 PM, Robert Relyea wrote: On 01/26/2012 05:08 AM, weizhong qiang wrote: hi, Is there a fact that nss does not permit the reading of the attribute

Re: how to get CKA_PRIVATE_EXPONENT attribute from a private key?

2012-01-28 Thread weizhong qiang
hi, On Jan 27, 2012, at 6:52 PM, Robert Relyea wrote: On 01/26/2012 11:53 PM, weizhong qiang wrote: hi, I did found that the CKA_SENSITIVE is true by using the following code: rv = PK11_ReadRawAttribute(PK11_TypePrivKey, privKey, CKA_SENSITIVE,value); if (rv != SECSuccess)

Re: how to get CKA_PRIVATE_EXPONENT attribute from a private key?

2012-01-27 Thread Robert Relyea
On 01/26/2012 06:50 PM, weizhong qiang wrote: hi, On Jan 26, 2012, at 6:28 PM, Robert Relyea wrote: On 01/26/2012 05:08 AM, weizhong qiang wrote: hi, Is there a fact that nss does not permit the reading of the attribute CKA_PRIVATE_EXPONENT, CKA_PRIME_1, etc.? Because with all of the eight

Re: how to get CKA_PRIVATE_EXPONENT attribute from a private key?

2012-01-27 Thread Robert Relyea
On 01/26/2012 11:53 PM, weizhong qiang wrote: hi, I did found that the CKA_SENSITIVE is true by using the following code: rv = PK11_ReadRawAttribute(PK11_TypePrivKey, privKey, CKA_SENSITIVE,value); if (rv != SECSuccess) { NSSUtilLogger.msg(ERROR, Failed to read

Re: how to get CKA_PRIVATE_EXPONENT attribute from a private key?

2012-01-26 Thread helpcrypto helpcrypto
Is eny error shown at NSSUtilLogger.msg(ERROR, Failed to read attribute %x from private key., type); ? El día 25 de enero de 2012 17:04, weizhong qiang weizhongqi...@gmail.com escribió: hi all, I tried to get the attributes from a private key (see the following code piece). But only the

Re: how to get CKA_PRIVATE_EXPONENT attribute from a private key?

2012-01-26 Thread weizhong qiang
Hi, It gives number 123, which is the type CKA_PRIVATE_EXPONENT. Thanks Weizhong qiang 在 2012-1-26 下午4:43,helpcrypto helpcrypto helpcry...@gmail.com写道: Is eny error shown at NSSUtilLogger.msg(ERROR, Failed to read attribute %x from private key., type); ? El día 25 de enero de 2012 17:04,

Re: how to get CKA_PRIVATE_EXPONENT attribute from a private key?

2012-01-26 Thread helpcrypto helpcrypto
my mistake. i mean the RV value -- dev-tech-crypto mailing list dev-tech-crypto@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-crypto

Re: how to get CKA_PRIVATE_EXPONENT attribute from a private key?

2012-01-26 Thread weizhong qiang
The rv value gives SECFailure. Thanks 在 2012-1-26 下午5:29,helpcrypto helpcrypto helpcry...@gmail.com写道: my mistake. i mean the RV value -- dev-tech-crypto mailing list dev-tech-crypto@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-crypto -- dev-tech-crypto mailing list

Re: how to get CKA_PRIVATE_EXPONENT attribute from a private key?

2012-01-26 Thread weizhong qiang
hi, Is there a fact that nss does not permit the reading of the attribute CKA_PRIVATE_EXPONENT, CKA_PRIME_1, etc.? Because with all of the eight attributes, it is possible to compose the content of the private key, but the outputting of private key is not allowed in nss? Thanks and Best

Re: how to get CKA_PRIVATE_EXPONENT attribute from a private key?

2012-01-26 Thread helpcrypto helpcrypto
AFAIK, returning or not the attributes from an object, depends on the token. I recommend you reading about CKO_PRIVATE_KEY on PKCS#11 standard to understand what can be happening. For example if token=card, CKA_PRIME_1 *musnt* be on the card, as far is not *needed* to do cryptographic operations.

Re: how to get CKA_PRIVATE_EXPONENT attribute from a private key?

2012-01-26 Thread weizhong qiang
On Jan 26, 2012, at 4:44 PM, helpcrypto helpcrypto wrote: AFAIK, returning or not the attributes from an object, depends on the token. Everything I am operating is on the nss internal softoken. I recommend you reading about CKO_PRIVATE_KEY on PKCS#11 standard to understand what can be

Re: how to get CKA_PRIVATE_EXPONENT attribute from a private key?

2012-01-26 Thread Robert Relyea
On 01/26/2012 07:55 AM, weizhong qiang wrote: On Jan 26, 2012, at 4:44 PM, helpcrypto helpcrypto wrote: AFAIK, returning or not the attributes from an object, depends on the token. Everything I am operating is on the nss internal softoken. Right softoken enforces good hygiene. In truth,

Re: how to get CKA_PRIVATE_EXPONENT attribute from a private key?

2012-01-26 Thread Robert Relyea
On 01/26/2012 05:08 AM, weizhong qiang wrote: hi, Is there a fact that nss does not permit the reading of the attribute CKA_PRIVATE_EXPONENT, CKA_PRIME_1, etc.? Because with all of the eight attributes, it is possible to compose the content of the private key, but the outputting of private

Re: how to get CKA_PRIVATE_EXPONENT attribute from a private key?

2012-01-26 Thread weizhong qiang
hi, On Jan 26, 2012, at 6:28 PM, Robert Relyea wrote: On 01/26/2012 05:08 AM, weizhong qiang wrote: hi, Is there a fact that nss does not permit the reading of the attribute CKA_PRIVATE_EXPONENT, CKA_PRIME_1, etc.? Because with all of the eight attributes, it is possible to compose the

how to get CKA_PRIVATE_EXPONENT attribute from a private key?

2012-01-25 Thread weizhong qiang
hi all, I tried to get the attributes from a private key (see the following code piece). But only the CKA_MODULUS and CKA_PUBLIC_EXPONENT can be got, others (CKA_PRIVATE_EXPONENT etc.) can not be got. Could you tell me how to solve it? By the way, I generate rsa key pair without sensitive