Re: Re: Re: why publickey sequence use DLSequence in CMP cr-CertTemplate entity ?

David Hook <dgh-rTAZ0PM/[email protected]> Thu, 23 May 2019 15:46:29 +1000
Newsgroups gmane.comp.encryption.bouncy-castle.devel
Organization Crypto Workshop Pty Ltd
Message-ID <[email protected]>
A DLSequence and a DERSequence generally mean the same thing. Either can
be used to produce a DER encoding as well. The difference is that on
reading you can't explicitly tell if you're parsing DER data or
definite-length data. The DLSequence is used to prevent things that have
been parsed accidentally getting DER encoded when they shouldn't be.

Regards,

David

On 23/5/19 11:45 am, J Gsealy wrote:
> Hi Matti,
>
> I was build a EC Keypair use "sm2p256v1" curve. And use bellow method
> to convert it
> ECGenParameterSpec ecGenParameterSpec = new
> ECGenParameterSpec("sm2p256v1"); KeyPairGenerator kp =
> helper.createKeyPairGenerator(/"EC"/);
> kp.initialize(ecGenParameterSpec); return kp.generateKeyPair();
> CertificateRequestMessageBuilder msgBuilder = new CertificateRequestMessageBuilder(this.certReqId);// add PublicKey final SubjectPublicKeyInfo keyInfo = SubjectPublicKeyInfo.getInstance(this.publicKey.getEncoded()); msgBuilder.setPublicKey(keyInfo);
> Is publickey not encode to DER?
>
> Thanks,
> Gsealy
>
>      
>     *From:* Matti Aarnio [via Bouncy Castle]
>     <mailto:[email protected]>
>     *Date:* 2019-05-23 01:17
>     *To:* Gsealy <mailto:[email protected]>
>     *Subject:* Re: why publickey sequence use DLSequence in CMP
>     cr-CertTemplate entity ?
>     Hi Gsealy,
>
>     That depends on the SubjectPublicKeyInfo object you give to the
>     /CertificateRequestMessageBuilder.setPublicKey(spki)/ method.
>     How did you create it?
>
>     BR, Matti
>
>
>     On 5/22/19 3:44 PM, J Gsealy wrote:
>>     Hi team,
>>
>>     I know CMP use DER encode and post by "application/pkixcmp"
>>     Content-Type.
>>
>>     I use BC CertificateRequestMessageBuilder class to create
>>     a cr(CertReqMessages) request, I found PublicKey entity is
>>     package by a DLSequence object
>>
>>     (use sm2), not Vector or DERSEquence (see attachment base64 text
>>     in "ECsm2req.txt")
>>
>>
>>
>>     But my simple request text was use DERSequence(use RSA) (see
>>     attachment base64 text in "RSAreq.txt")
>>
>>
>>
>>     use DLSequence is right? and what's different with others
>>     encode type(BER/DER)?
>>
>>     Thanks,
>>     Gsealy
>
>
>
>
>     ------------------------------------------------------------------------
>     If you reply to this email, your message will be added to the
>     discussion below:
>     http://bouncy-castle.1462172.n4.nabble.com/why-publickey-sequence-use-DLSequence-in-CMP-cr-CertTemplate-entity-tp4659620p4659621.html
>     <https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fbouncy-castle.1462172.n4.nabble.com%2Fwhy-publickey-sequence-use-DLSequence-in-CMP-cr-CertTemplate-entity-tp4659620p4659621.html&data=02%7C01%7C%7Cd1a699b289304c4e9b2808d6ded96fac%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636941422796127522&sdata=8lqE1wxMlpDAprGKT61%2Bg1EseObxnigSJvfHYlraQ6U%3D&reserved=0>
>
>     To start a new topic under Bouncy Castle - Dev, email
>     [email protected]
>     To unsubscribe from Bouncy Castle - Dev, click here
>     <https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fbouncy-castle.1462172.n4.nabble.com%2Ftemplate%2FNamlServlet.jtp%3Fmacro%3Dunsubscribe_by_code%26node%3D1462173%26code%3Damlhb2ppbmd3ZWkxMDAxQGhvdG1haWwuY29tfDE0NjIxNzN8NzIyNDYzNTY3&data=02%7C01%7C%7Cd1a699b289304c4e9b2808d6ded96fac%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636941422796147545&sdata=myeqUCpx3kE407j0x2LtqKXdaVZffrM7seyPZBbtXBY%3D&reserved=0>.
>     NAML
>     <https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fbouncy-castle.1462172.n4.nabble.com%2Ftemplate%2FNamlServlet.jtp%3Fmacro%3Dmacro_viewer%26id%3Dinstant_html%2521nabble%253Aemail.naml%26base%3Dnabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace%26breadcrumbs%3Dnotify_subscribers%2521nabble%253Aemail.naml-instant_emails%2521nabble%253Aemail.naml-send_instant_email%2521nabble%253Aemail.naml&data=02%7C01%7C%7Cd1a699b289304c4e9b2808d6ded96fac%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636941422796157550&sdata=N8%2Ff%2BBeJmQmUhb9DwR2Jl9tRNavVz6GtjZFQIO3%2Bzfc%3D&reserved=0>
>
>