From: Brian W. <bwe...@xb...> - 2013-03-05 18:24:32
|
On Mar 4, 2013, at 9:31 PM, shuoleo@126 <sh...@12...> wrote: > Hi , > > I'm using dnsjava to add DS record to BIND, but I have met a problem with the constructor of DSRecord. > > String rrdata= "65512-8-2-E2D3C916F6DEEAC73294E8268FB5885044A833FC5459588F4A9184CF C41A5766"; > String[] dsParams = rdata.split("-"); > if(dsParams != null && dsParams.length == 4){ > DSRecord dsRecord = new DSRecord(new Name(hostName), DClass.IN, ttl, Integer.valueOf(dsParams[0]).intValue(), > Integer.valueOf(dsParams[1]).intValue(), Integer.valueOf(dsParams[2]).intValue(), dsParams[3].getBytes()); > But I got it from BIND like the follows: > abc.test. 3600 IN DS 65512 8 2 4532443343393136463644454541433733323934453832363846423538383530343441383333464335343539353838463441393138344346204334314135373636 > > which should be looks like: > abc.test. 3600 IN DS 65512 8 2 8083381765C090E5FB9919FDF3D4473D5FBFC77C > > What should I do to achieve that? I think the problem is that you're calling the DSRecord constructor with hex-encoded bytes, rather than raw bytes. It's probably easiest to just replace the dashes in your input and use Record.fromString() instead, but you could also decode the hex bytes before calling the constructor. Brian |